Files
blog/.github/workflows/update-pages.yml
T
tiennm99 f9927e6098 feat(ci): replace github-pages shortcode with daily workflow
Fetch repos server-side via GitHub API using PAGES_FETCH_TOKEN and
inject the pages list into content/page/pages/index.md between HTML
markers. Runs daily at 00:00 Asia/Saigon and on manual dispatch.
2026-04-22 19:57:36 +07:00

50 lines
1.3 KiB
YAML

name: Update GitHub Pages list
on:
schedule:
# 00:00 Asia/Saigon (UTC+7) = 17:00 UTC
- cron: "0 17 * * *"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: update-pages
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
env:
TZ: Asia/Ho_Chi_Minh
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# Use PAT so the subsequent commit+push triggers the build workflow.
token: ${{ secrets.PAGES_FETCH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
- name: Refresh pages list
env:
GH_TOKEN: ${{ secrets.PAGES_FETCH_TOKEN }}
GH_USER: tiennm99
run: node .github/scripts/update-pages-list.mjs
- name: Commit and push
run: |
if [[ -z "$(git status --porcelain content/page/pages/index.md)" ]]; then
echo "No changes to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add content/page/pages/index.md
git commit -m "chore(pages): refresh GitHub Pages list"
git push