Files
LangBot/.github/workflows/sync-github-wiki.yml
T
0582d1b3d4 chore: rename internal docs/ to dev-docs/ and prepare docs site merge
Move the 27 internal design docs (87 tracked files) from docs/ to dev-docs/
to make room for the public documentation site, adjust Docker/fnOS ignores,
refresh the README/AGENTS/ARCHITECTURE references, and land the docs
workflows ahead of the subtree import so they cannot diverge from mirror.

Co-Authored-By: Mika (Multica) <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-10-27 08:04:20 +00:00

91 lines
2.7 KiB
YAML

name: Sync GitHub Wiki
on:
push:
branches: [main]
paths:
- "docs/en/**"
- "docs/zh/**"
- "docs/ja/**"
- "docs/scripts/build-github-wiki.py"
- ".github/workflows/sync-github-wiki.yml"
pull_request:
paths:
- "docs/en/**"
- "docs/zh/**"
- "docs/ja/**"
- "docs/scripts/build-github-wiki.py"
- "docs/tests/test_build_github_wiki.py"
- ".github/workflows/sync-github-wiki.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: sync-langbot-github-wiki
cancel-in-progress: false
jobs:
build:
defaults:
run:
working-directory: docs
name: Build Wiki mirror
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Run converter tests
run: python -m unittest tests/test_build_github_wiki.py
- name: Build Wiki pages
run: python scripts/build-github-wiki.py --output dist/github-wiki
- name: Validate generated pages
run: |
test -f dist/github-wiki/Home.md
test -f dist/github-wiki/_Sidebar.md
test "$(find dist/github-wiki -maxdepth 1 -name '*.md' | wc -l)" -gt 250
- name: Upload generated Wiki
uses: actions/upload-artifact@v7
with:
name: github-wiki
path: docs/dist/github-wiki
if-no-files-found: error
sync:
name: Publish to LangBot Wiki
if: github.event_name != 'pull_request' && github.repository == 'langbot-app/LangBot' && github.ref == 'refs/heads/main' && vars.DOCS_MIRROR_ENABLED == 'true'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/download-artifact@v8
with:
name: github-wiki
path: generated
- name: Clone target Wiki
env:
WIKI_PUSH_TOKEN: ${{ secrets.LANGBOT_WIKI_PUSH_TOKEN }}
run: |
test -n "$WIKI_PUSH_TOKEN"
git clone "https://x-access-token:${WIKI_PUSH_TOKEN}@github.com/langbot-app/LangBot.wiki.git" target
- name: Replace and publish Wiki contents
env:
SOURCE_SHA: ${{ github.sha }}
run: |
find target -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
cp -a generated/. target/
cd target
git add -A
if git diff --cached --quiet; then
echo "GitHub Wiki is already up to date."
exit 0
fi
git config user.name "langbot-docs-sync[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "docs: sync from LangBot/docs@${SOURCE_SHA::7}"
git push origin HEAD:master