Update Plugin Data #211
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Plugin Data | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "10 0 * * *" # Every day at 00:10 UTC | |
permissions: | |
contents: write | |
jobs: | |
update-data: | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@v16 | |
- name: Setup Nix cache | |
uses: DeterminateSystems/flakehub-cache-action@v1 | |
- name: Cache database | |
uses: actions/cache@v4 | |
with: | |
path: indexer.db | |
key: indexer-db-${{ github.run_id }} | |
restore-keys: | | |
indexer-db- | |
indexer-db | |
- name: Clear data directory | |
run: | | |
rm -rf data/ | |
mkdir -p data/ | |
- name: Build indexer | |
run: nix build .#jb-repo-indexer | |
- name: Run indexer | |
id: run-indexer | |
timeout-minutes: 345 | |
continue-on-error: true # Continue even if the indexer fails or times out | |
env: | |
JB_REPO_INDEXER_LOG: info | |
run: | | |
ulimit -n 65536 | |
nix run .#jb-repo-indexer -- --database indexer.db --output-directory data | |
- name: Upload database artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: indexer-db | |
path: indexer.db | |
retention-days: 7 | |
- name: Check for changes | |
if: steps.run-indexer.outcome == 'success' | |
id: git-check | |
run: | | |
git add data/ | |
git status --porcelain | |
echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT | |
- name: Commit changes | |
if: steps.git-check.outputs.changed > 0 && steps.run-indexer.outcome == 'success' | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git commit -m "Update plugin data" | |
git push |