Blockchain Indexer #7904
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: Blockchain Indexer | |
| on: | |
| schedule: | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| jobs: | |
| index-blockchain: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run indexer | |
| run: node ./src/indexer.js | |
| - name: Stash changes (if any) | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add -A | |
| git stash --include-untracked || echo "No changes to stash" | |
| - name: Pull latest changes | |
| run: git pull --rebase origin main | |
| - name: Apply stashed changes (if any) | |
| run: git stash pop || echo "No stashed changes to apply" | |
| - name: Commit and push data | |
| run: | | |
| git add data/ | |
| git commit -m "Update blockchain indexer data" || echo "No changes to commit" | |
| git push origin main |