Files
ai-workflow-course/.gitea/workflows/sync-wiki.yml
T
claude 3c1c94fb1a
Sync course wiki / sync-wiki (push) Has been cancelled
Generate the course textbook into the wiki from modules/ (CI sync) (#72)
Co-authored-by: claude <claude@jpaul.io>
Co-committed-by: claude <claude@jpaul.io>
2026-06-22 18:53:11 -04:00

52 lines
1.8 KiB
YAML

# Render the course (single source of truth = modules/) into the Gitea wiki on
# every push to main. The wiki is generated BUILD OUTPUT — never hand-edit it.
#
# Prerequisites (one-time):
# 1. An Actions runner is attached to this repo/org (Settings -> Actions -> Runners).
# 2. A repo secret WIKI_TOKEN holds a token with write access to the wiki
# (a PAT/deploy token scoped to repository write is enough — NOT a site-admin token).
# 3. The wiki is initialized (it is — created with a Home page).
name: Sync course wiki
on:
push:
branches: [main]
paths:
- 'modules/**'
- 'capstone/**'
- 'README.md'
- 'tools/build_wiki.py'
- '.gitea/workflows/sync-wiki.yml'
workflow_dispatch: {}
jobs:
sync-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Render and push the wiki
shell: bash
env:
WIKI_TOKEN: ${{ secrets.WIKI_TOKEN }}
run: |
set -euo pipefail
if [ -z "${WIKI_TOKEN:-}" ]; then
echo "::error::WIKI_TOKEN secret is not set — see this workflow's header."
exit 1
fi
base="git.jpaul.io/justin/ai-workflow-course"
git clone "https://claude:${WIKI_TOKEN}@${base}.wiki.git" wiki
python3 tools/build_wiki.py --repo-root . --out wiki \
--web-base "https://${base}" --branch main --host gitea
cd wiki
git config user.name "claude"
git config user.email "claude@jpaul.io"
git add -A
if git diff --cached --quiet; then
echo "wiki already up to date"; exit 0
fi
git commit -m "docs(wiki): sync from modules/ @ $(echo "$GITHUB_SHA" | cut -c1-8)"
git push origin HEAD