Skip to content

Docs Workflow

The .github/workflows/docs.yml workflow builds the VitePress documentation site and publishes it to GitHub Pages. A pull request builds the site to prove it still builds; only a push to main publishes it.

Trigger Events

EventFilterWhat runs
pushbranch main, the paths belowbuild and deploy
pull_requestthe paths belowbuild only
workflow_dispatchbuild and deploy

Both path filters carry the same four entries:

yaml
- 'docs/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/docs.yml'

package-lock.json is in the list because npm ci reads it: a dependency bump can break the build without touching a single page.

Permissions

PermissionValuePurpose
contentsreadCheck out the repository
pageswritePublish to GitHub Pages
id-tokenwriteOIDC token for the Pages deployment

The two write permissions are declared at workflow level and therefore present on a pull-request run as well. What keeps a branch from replacing the live site is the event guard on the publishing steps, not the permission set. internal/cicheck/docs_workflow_test.go pins that guard.

Concurrency

yaml
group: ${{ github.event_name == 'pull_request' && format('docs-pr-{0}', github.ref) || 'pages' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Pushes share the single pages group and never cancel each other, so a half-finished publish is always allowed to finish. Each pull request gets its own group and does cancel its own superseded builds, which is the right trade for a check that only reports.

Jobs

build

Runs on ubuntu-latest with a 10-minute timeout, on every trigger.

StepCommand or actionPurpose
Checkoutactions/checkout with fetch-depth: 0Full history, which VitePress reads for page timestamps
Setup Nodeactions/setup-node, Node 22, cache: npmToolchain and dependency cache
Install dependenciesnpm ciInstall from the lockfile
Build docsnpm run docs:buildRender the site into docs/.vitepress/dist
Configure Pagesactions/configure-pagesPages settings — push only
Upload artifactactions/upload-pages-artifactUpload distpush only

The two Pages steps carry if: github.event_name != 'pull_request', so a pull request stops after the build.

deploy

Runs on ubuntu-latest with a 5-minute timeout, needs: build, and the same if: github.event_name != 'pull_request'. It publishes the uploaded artifact through actions/deploy-pages into the github-pages environment and reports the page URL as its output. On a pull request the job is skipped.

npm run docs:build fails on a markdown link to a page that does not exist, and docs/.vitepress/config.mts sets no ignoreDeadLinks. The build step is therefore the dead-link check as well as the build, which is the reason the workflow runs on pull requests at all: before this, a link that pointed nowhere was found only after it had already broken the published page.

A link that must point at something the check cannot resolve — an anchor generated at runtime, a file outside docs/ — needs an entry in ignoreDeadLinks rather than a suppression at the link itself. Adding one turns the check off for that pattern everywhere, so it is worth a sentence in the pull request.

Building locally

bash
npm ci
npm run docs:build     # what CI runs, dead-link check included
npm run docs:dev       # live preview on http://localhost:5173
npm run docs:preview   # serve the built site

The build takes a few seconds on a warm cache. Run it before pushing a change under docs/: it is the same command CI runs and it catches the same dead links.

Action Versions

All actions are pinned to full SHA hashes for supply-chain hardening, the rule internal/cicheck enforces for every workflow in this repository. The checkout and setup-node pins match those in the other workflows.

ActionVersionSHAPurpose
actions/checkoutv4.3.134e114876b0b11c390a56381ad16ebd13914f8d5Repository checkout
actions/setup-nodev4.4.049933ea5288caeca8642d1e84afbd3f7d6820020Node installation and npm cache
actions/configure-pagesv5.0.0983d7736d9b0ae728b81ab479565c72886d7745bGitHub Pages configuration
actions/upload-pages-artifactv3.0.156afc609e74202658d3ffba0e8f6dda462b719faUpload the rendered site
actions/deploy-pagesv4.0.5d6db90164ac5ed86f2b6aed7e0febac5b3c0c03eDeploy to GitHub Pages

See Also