Auto-sync docs/ to GitHub + Gitea wikis#4
Merged
Conversation
scripts/sync-wiki.ps1 clones a wiki repo, copies+flattens markdown from docs/ with a slug mapping (e.g. recipes/zerto-pre-post-scripts.md becomes the Recipe-Zerto-Failover page), rewrites in-repo markdown links to wiki-style targets, generates a _Sidebar.md, and pushes back if anything changed. Idempotent. .github/workflows/wiki-sync.yml runs the sync on every push to main that touches docs/ (or the sync tooling itself). Uses GITHUB_TOKEN which has wiki write access via the contents:write permission. For Gitea, no Windows runner is available, so the script is invoked manually with a Gitea PAT in the URL. One-time setup for each remote: enable Wiki in repo settings, create a Home page via the web UI to initialize the wiki repo, then run the sync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wiki sync
Mirrors
docs/to a wiki repo on every push tomainthat touchesdocs/. Single source of truth staysdocs/; the wiki is a publishing target.Bits
scripts/sync-wiki.ps1— clones the wiki repo, copies and flattens markdown fromdocs/, rewrites in-repo links to wiki-style page slugs, generates_Sidebar.md, commits and pushes if anything changed. Idempotent. Reusable for both GitHub and Gitea..github/workflows/wiki-sync.yml— runs the script on every push tomainunderdocs/**(plusworkflow_dispatchfor manual). UsesGITHUB_TOKENwithcontents: write, no PAT needed.One-time setup before this fires
Page mapping
The slug transformation is in the script:
docs/recipes/zerto-pre-post-scripts.mdbecomes wiki pageRecipe-Zerto-Failover, etc. Editing the mapping table is how you add or rename pages.Gitea
No Windows runner available there, so the script is invoked manually from a shell. Works the same way.
Generated with Claude Code