Refresh Regulatory News #24
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: Refresh Regulatory News | |
| on: | |
| # Daily at 7 AM UTC — accumulates RSS items into src/data/recentNews.json | |
| schedule: | |
| - cron: '0 7 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| refresh-news: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| 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: Fetch news (with retry) | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 5 | |
| max_attempts: 3 | |
| retry_wait_seconds: 60 | |
| command: node scripts/fetch-news.cjs | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet src/data/recentNews.json; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected in news data" | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in news data" | |
| fi | |
| - name: Commit and push changes | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add src/data/recentNews.json | |
| git commit -m "chore: refresh regulatory news ($(date -u +%Y-%m-%d))" | |
| git push | |
| trigger-deploy: | |
| needs: refresh-news | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.refresh-news.result == 'success' }} | |
| steps: | |
| - name: Trigger Vercel Deploy Hook | |
| env: | |
| VERCEL_DEPLOY_HOOK: ${{ secrets.VERCEL_DEPLOY_HOOK }} | |
| run: | | |
| if [ -n "$VERCEL_DEPLOY_HOOK" ]; then | |
| curl -X POST "$VERCEL_DEPLOY_HOOK" | |
| echo "Vercel deployment triggered" | |
| fi |