Skip to content

Workflow wiki publish

github-actions[bot] edited this page Oct 25, 2026 · 2 revisions

wiki-publish

What it does. Runs a command that generates a wiki tree, then replaces the repository's GitHub wiki with it, as github-actions[bot], only when something changed, from the default branch only.

Why it exists. A wiki written by hand drifts from the code it describes. A wiki that is a generated mirror of something else, usually the docs, cannot. Every run replaces every page, so a page the generator stops writing disappears. It came from Hammunition's wiki.yml, split into two jobs so the write token is never beside the generator. This wiki is published by it; see Adopting GYST in your own project.

Jobs and trust boundaries

Job Holds Notes
generate contents: read Runs install-command and generate-command, keeps the tree as an artifact. Runs on pull requests too, so a broken generator fails review. An empty tree is refused, because publishing it would empty the wiki
publish contents: write Checks out only the wiki, runs none of your commands. Default branch only, never a pull request. Fixed concurrency group wiki, never cancelled halfway through a push

The wiki checkout is the one checkout in the repository that keeps its credentials, deliberately: the token reaches git through the clone's own config, never a shell variable, an argument or a URL. The commit names the source commit; nothing is pushed when the tree is unchanged.

A minimal caller

on:
  push: { branches: [main] }
  workflow_dispatch:

jobs:
  wiki:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/wiki-publish.yml@<sha> # vX.Y.Z
    permissions:
      contents: write   # the publish job only
    with:
      install-command: pip install -e ".[docs]"
      generate-command: python scripts/gen_wiki.py --out "$OUT_DIR" --commit "$SOURCE_SHA"

The owner does one thing once, and GitHub offers it only in the UI. A wiki's git repository does not exist until its first page is made: open the repository's Wiki tab, choose "Create the first page", save anything, then re-run. Until then publish fails with exactly that instruction. The wiki feature must also be enabled in the repository's settings.

Inputs (9), read from wiki-publish.yml:

Input Type Default Meaning
generate-command string required Shell that writes the wiki tree (pages as files, flat, the way a wiki stores them) into $OUT_DIR. $SOURCE_SHA holds the commit being published. The tree must be non-empty; an empty one is refused rather than published as an empty wiki. (required)
out-dir string wiki-out Directory the generator writes, relative to the repository root and inside it. Exported to generate-command as $OUT_DIR.
python-version string 3.11 Python used by the install and generate commands.
install-command string empty Shell run before generate-command, e.g. the project's docs extra; empty installs nothing.
publish boolean true Push the tree to the wiki. false generates and uploads it without publishing, for a repository that is trying the workflow.
egress-policy string audit harden-runner egress policy for every job - audit logs outbound connections, block allows only allowed-endpoints.
allowed-endpoints string api.github.com:443 files.pythonhosted.org:443 github.com:443 pypi.org:443 harden-runner allow-list for block, space-separated host:port entries. Wildcards are not supported and a newline-separated list matches nothing. The runner's own infrastructure needs no entry.
extra-allowed-endpoints string empty Appended to allowed-endpoints, for hosts only this repository reaches. Same format.
timeout-minutes number 10 Per-job timeout.

What it refuses to do

It never publishes from a pull request, never publishes an empty tree, never runs your generator beside the write token, and never writes by hand: every page that is not in the generated tree is removed.

Clone this wiki locally