NFL News Scraper #198
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: NFL News Scraper | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| scrape-news: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: website-ts/package-lock.json | |
| - name: Install dependencies | |
| working-directory: website-ts | |
| run: npm ci | |
| - name: Run NFL News Scraper | |
| working-directory: website-ts | |
| env: | |
| OPENAI_REFRESH_TOKEN: ${{ secrets.OPENAI_REFRESH_TOKEN }} | |
| SECRET_UPDATER: ${{ secrets.SECRET_UPDATER }} # Grant script access to update secrets | |
| run: npx tsx scripts/nfl-scraper/runAll.ts | |
| - name: Check for changes | |
| id: git-check | |
| working-directory: website-ts | |
| run: | | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changes == 'true' | |
| working-directory: website-ts | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "NFL News Bot" | |
| git commit -m "🏈 Auto-update: NFL news articles $(date +'%Y-%m-%d %H:%M')" | |
| git push |