Automate Forgejo-to-GitHub wiki mirror sync #63
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The main repo is mirrored from Forgejo to GitHub via Forgejo's native push-mirror feature. That mirror handles the code, branches, tags, and PRs/merges as they land on Forgejo's main branch.
Wikis are different. Forgejo's push-mirror API operates on the main repo's git refs, not on the
.wiki.gitsibling repo. There is no equivalent API for mirroring a wiki. At the moment, the Forgejo and GitHub wikis happen to be in sync (verified by SHA match of HEAD), but they will drift the moment anyone edits the Forgejo wiki next.Goal
A small, reliable automation that keeps the GitHub wiki in sync with the Forgejo wiki with no manual intervention.
Proposed approach
A cron-driven sync script. Simple, fails loudly, easy to diagnose.
ssh://git@10.0.0.51:2222/archeious/luminos.wiki.gitkept somewhere durable (suggest/var/lib/luminos-wiki-mirror/or a user directory on the host that owns the cron).scripts/sync-wiki-to-github.shin this repo. Does:git fetch origin main(origin = Forgejo)origin/mainis ahead ofgithub/main; if not, exit 0 with no outputgit push github main(github = GitHub wiki via the PAT)GITHUB_LUMINOS_MIRROR_TOKENstored in~/secrets. Read at script start, embed in the remote URL temporarily, scrub from process env on exit./var/log/luminos-wiki-mirror.log(or a per-user log) on every run:<timestamp> <forgejo-head> <github-head> <status>. Makes it trivial to see when the last sync happened and whether it was a no-op or a real push.r720xd-1orhome-node-1, wherever the backup cron already lives, to keep the cron footprint consolidated).Alternatives considered
Definition of done
scripts/sync-wiki-to-github.shchecked in, executable, with a clear header comment--dry-runorDRY_RUN=1) that reports what it would do without pushingOut of scope
mainbranch on the wiki repo.Refs
Gotcha from the initial manual push
GitHub's wiki renderer looks for the
masterbranch by default on this wiki (the wiki repo was created with no HEAD symbolic ref andmainalone is not enough). Pushing content only tomainproduces a working git repo but an empty-looking wiki page in the GitHub UI.Fix the script will need: push to both
mainandmaster, or configure the wiki repo's default branch. Simplest is push to both. Verified working 2026-04-09 by force-pushingmain:master.After the fix,
git ls-remoteon the GitHub wiki showed:The cron sync script (#63 DoD) should either:
git push github main:main main:master), orRecording this so future-me doesn't spend 20 minutes debugging "why is my wiki empty when git ls-remote shows content."