Fetch Data #79
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: Fetch Data | |
| on: | |
| schedule: | |
| - cron: '30 7 * * *' | |
| - cron: '30 22 * * 1,3' | |
| workflow_dispatch: | |
| jobs: | |
| fetch: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run fetch script | |
| run: pnpm exec tsx scripts/fetch.ts | |
| env: | |
| WCL_CLIENT_ID: ${{ secrets.WCL_CLIENT_ID }} | |
| WCL_CLIENT_SECRET: ${{ secrets.WCL_CLIENT_SECRET }} | |
| - name: Commit data snapshot | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add data/ | |
| if git diff --cached --quiet; then | |
| echo "No data changes to commit." | |
| else | |
| git commit -m "chore: data snapshot $(date -u +%Y-%m-%d)" | |
| git push | |
| fi | |
| # Cloudflare Pages detects the data commit above and deploys automatically. | |
| # No manual trigger needed. |