Forgejo Wiki Publishing And Docs Check
The Forgejo wiki publishing pipeline turns docs/wiki into the built-in Forgejo wiki repository. It also explains why git attributes alone cannot make Forgejo auto-detect an in-repo docs directory as the built-in wiki.
Purpose
Use this page when adding or renaming wiki pages, debugging Forgejo wiki links, fixing publish workflow failures, or explaining why pages must be exported into the separate .wiki.git repository.
Source Tree Versus Forgejo Output
docs/wiki is the source tree. Forgejo's built-in wiki reads a separate wiki git repository. The workflow exports source pages into target/forgejo-wiki-export, then commits those files to the repository's .wiki.git remote.
Docs Check Rules
xtask docs-check verifies front matter, ISO last_reviewed values, active system/workflow headings, relative links, and reachability from docs/wiki/README.md. System pages must follow the system-page template. Authoring and debugging pages must follow the workflow-page template.
Flattening And Link Rewrite
Forgejo wiki output is flat. Root README.md becomes Home.md. Section READMEs become section pages such as Runtime.md. Other pages keep their basename. Local markdown links are rewritten to point at the flattened output names.
Generated Wiki Pages
Generated documentation such as the realtime protocol registry and environment configuration reference lives directly under docs/wiki. The normal flattening and link-rewrite pass exports it with the hand-authored pages, while generated-artifact checks keep it synchronized with source registries.
Workflow Triggers And Secrets
The workflow runs on manual dispatch and pushes to main or master that touch wiki files or the workflow. Publishing needs FORGEJO_WIKI_TOKEN or an available Forgejo/GitHub token plus server, API, and repository environment values.
Failure Playbook
If clone fails because the wiki does not exist, the workflow tries to initialize Home through the Forgejo API. If subpage links show 500s, rerun export validation and confirm no subdirectories remain. If publishing says variables are unbound, use the fallback environment variables documented in the workflow.
Adding Or Renaming Pages Checklist
Add front matter, link the page from a reachable index, run xtask docs-check, run the exporter, check exported links, check no exported subdirectories, then rerun the Forgejo action.