Generate Static Data #11478
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: Generate Static Data | |
| on: | |
| schedule: | |
| # Run every 10 minutes | |
| - cron: '*/10 * * * *' | |
| workflow_dispatch: # Allow manual triggering | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'subassets_priced.csv' | |
| - 'scripts/generate-static-data.ts' | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate static data | |
| run: npm run generate-static | |
| timeout-minutes: 5 | |
| - name: Check for changes | |
| id: verify-changed | |
| run: | | |
| git diff --quiet public/data/ || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push if changed | |
| if: steps.verify-changed.outputs.changed == 'true' | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add public/data/ | |
| git commit -m "Update static data [skip ci]" | |
| git pull --rebase origin main | |
| git push |