Skip to content

Generated documentation and GitHub Pages

Review artifacts

The workflow builds and verifies the template through Task. It uploads HTML and JUnit test results for 14 days, including available diagnostics after failure. Individual cases appear in the Actions job summary using the pinned standard report publisher. The original test exit status remains authoritative.

This workflow uses contents: read only. It does not request new write permissions, create dedicated Checks through the API, deploy Pages, or change settings. Untrusted pull requests receive no secrets, and verification runs in a container without network access. Image builds still require public dependency downloads; source imports and Taskfiles must be reviewed as executable code.

Download the generated-documentation artifact from the workflow run, extract it, and open html/index.html. Retained source coverage pages are intended only for reviewable public source. Check emitted versus ingested test counts in the summary. Local links and fragments are checked offline; external link availability is not part of this fixture's claim. These downloads support review; the repository's deployed manual is a separate destination with its own verification.

Repository Pages manual

Each repository hosts its own public GitHub Pages documentation, following the manual and completion guidance. This is the adoption standard, not a statement that this repository's fixture or all existing repositories already deploy Pages. Implement adoption through a small repository PR, reusing its documentation build. Do not change organization-wide settings or enable other repositories as a side effect. Existing authorization for a specific repository remains valid; resolve any missing setup authority only for that repository. Review public output, including source in coverage pages, before publishing.

Use GitHub's custom Pages workflow with these boundaries when adapting the repository's existing pipeline:

  • Build and verify with Task using the repository's pinned tooling. Configure the generator for the actual Pages base path. Upload only the generated public site with actions/upload-pages-artifact, not the checkout or diagnostic bundle.
  • Deploy only from trusted main, after the build and checks pass. Limit automatic triggers to pushes on main; if manual dispatch is offered, also check the ref is refs/heads/main. Never deploy PR output, run fork code with write privileges, or use pull_request_target to build documentation.
  • Keep build/PR jobs at contents: read. Put pages: write and id-token: write only on a separate deployment job using actions/deploy-pages, with needs pointing to the successful build job. That job deploys the artifact without checking out or executing project code. Use the github-pages environment, scoped to main, and expose the deployment's page_url as its environment URL.
  • Pin reviewed Action revisions, following the existing repository convention. Keep ordinary review downloads at the 14-day default; the Pages transfer artifact is deployment transport, not the durable manual or a user download promise.
  • Serialize deployments so an older run cannot overwrite a newer manual. Inside the deployment lock, before actions/deploy-pages, read repos/<owner>/<repo>/git/ref/heads/main and publish only when that object SHA is still the candidate. Send the workflow token with the read. contents: read is enough; do not grant contents: write for this check. An anonymous call shares the runner rate limit, returns HTTP 403, and leaves the site on the previous release. Pass the token through the step environment, then use either form below. Keep a test that fails when a workflow calls that URL without one of those forms.
  • Verify the actual public URL and live navigation/search after deployment, then add the prominent README link. Record the deployed source revision and run; settings or a successful upload alone do not establish a working site.

gh api reads GH_TOKEN from the environment:

permissions:
  contents: read
jobs:
  deploy:
    permissions:
      contents: read
      pages: write
      id-token: write
    steps:
      - name: Require current main
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          ref="repos/${GITHUB_REPOSITORY}/git/ref/heads/main"
          current=$(gh api "$ref" --jq .object.sha)
          test "$current" = "$GITHUB_SHA"

urllib must send Authorization: Bearer and open that request:

import json
import os
import urllib.request

token = os.environ["GITHUB_TOKEN"]
repo = os.environ["GITHUB_REPOSITORY"]
url = f"https://api.github.com/repos/{repo}/git/ref/heads/main"
request = urllib.request.Request(
    url,
    headers={"Authorization": f"Bearer {token}"},
)
with urllib.request.urlopen(request, timeout=30) as response:
    current = json.load(response)["object"]["sha"]

Pass GITHUB_TOKEN the same way (GITHUB_TOKEN: ${{ github.token }}).

The existing artifact workflow above remains unchanged. A consumer must implement and verify its Pages deployment; this guide neither enables Pages nor installs a new workflow. The livingproof deployment is separate repository work.


Documentation home · Docs: v9.15.0 · Version and source · Help / report an issue · License