Skip to content

Update Sitemap

Update Sitemap #20

name: Update Sitemap
on:
schedule:
- cron: "0 6 * * *" # Daily at 06:00 UTC
workflow_dispatch: # Allow manual trigger
jobs:
update-sitemap:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout react app
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout content repo
uses: actions/checkout@v4
with:
repository: isaaccomputerscience/isaac-content
path: content-repo
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Index content dates
run: yarn index-content-dates
env:
CONTENT_REPO_PATH: ${{ github.workspace }}/isaac-content
- name: Generate sitemap
run: yarn generate-sitemap
env:
ISAAC_ENV: production
- name: Commit if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add public/sitemap.xml scripts/content-dates.json
git diff --cached --quiet || \
(git commit -m "chore: update sitemap [skip ci]" && git push)