diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..e55d6f7 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +set -eu + +ROOT_DIR="$(git rev-parse --show-toplevel)" +cd "$ROOT_DIR" + +if ! command -v python3 >/dev/null 2>&1; then + echo "[sitemap] python3 not found; cannot generate sitemap." >&2 + exit 1 +fi + +python3 scripts/generate_sitemap.py +git add sitemap.html + diff --git a/.github/workflows/sitemap-scheduled-update.yml b/.github/workflows/sitemap-scheduled-update.yml new file mode 100644 index 0000000..8613391 --- /dev/null +++ b/.github/workflows/sitemap-scheduled-update.yml @@ -0,0 +1,38 @@ +name: Scheduled Sitemap Update + +on: + schedule: + - cron: "23 2 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-sitemap: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Generate sitemap + run: python3 scripts/generate_sitemap.py + + - name: Commit and push if changed + run: | + if git diff --quiet -- sitemap.html; then + echo "No sitemap changes." + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add sitemap.html + git commit -m "chore: auto-update sitemap" + git push diff --git a/news/data/index.html b/news/data/index.html index b127809..c417d28 100644 --- a/news/data/index.html +++ b/news/data/index.html @@ -3,7 +3,7 @@
-