Update robots.txt #65
This file contains 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: Update robots.txt | |
on: | |
schedule: | |
- cron: "0 7 * * *" # Runs daily at 7 AM UTC | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: write # Required to push changes | |
jobs: | |
update-robots: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Update robots.txt | |
run: npm run update-robots | |
- name: Commit changes | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add src/pages/robots.txt.ts | |
git diff --quiet && git diff --staged --quiet || git commit -m "chore: update robots.txt" | |
- name: Push changes | |
run: git push |