Documentation
¶
Overview ¶
Command workflowcheck enforces the workflow hygiene rules of AD-27 on every GitHub Actions workflow:
- every remote `uses:` (step or reusable workflow) is pinned to a full 40-hex commit SHA; `docker://` images are pinned by `@sha256:` digest; local `./` references need no pin;
- the top-level `permissions` is exactly `contents: read`;
- write scopes (and `write-all`) appear only at job level, and a job never asks for `write-all`;
- no workflow other than npm-bootstrap.yml references NPM_TOKEN, NPM_BOOTSTRAP_TOKEN or NODE_AUTH_TOKEN, or gives actions/setup-node a registry-url (which writes a token .npmrc): npm publishes through OIDC trusted publishing, and the one-time bootstrap token is confined to that workflow (Story 4.5);
- no workflow references PYPI_API_TOKEN or PYPI_TOKEN in any case (TEST_PYPI_* included), sets a TWINE_PASSWORD or INPUT_PASSWORD env key, or gives pypa/gh-action-pypi-publish a password: PyPI wheels upload through OIDC trusted publishing only (Story 4.6);
- the tap and bucket credentials HOMEBREW_TAP_DEPLOY_KEY, SCOOP_BUCKET_DEPLOY_KEY (Story 4.28) and the fallback tokens HOMEBREW_TAP_TOKEN, SCOOP_BUCKET_TOKEN appear only inside the tap-publish job of release.yml, that job asks for no id-token, and no workflow uses toJSON(secrets) or `secrets: inherit` (Story 4.4);
- `packages: write` (or a job's `write-all`) appears only in the docker-publish job of release.yml, the one job that pushes the container image to ghcr.io (Story 4.7);
- in release.yml (the release chain, with a release-please job) every job except release-please, changelog and tag-signature depends on tag-signature, directly or through its needs chain, so nothing is built or published before the release tag's signature is checked (Story 4.12);
- release-gates.yml asks for no write scope, and post-publish.yml for none but `issues: write` (the release-blocker issue): the gate and install checks run release-PR and published code, so they never get a token that can push, publish, sign or comment on pull requests (Story 4.18); nightly.yml (the heavy CI tier) asks for none but `issues: write` (the ci-nightly issue) and `id-token: write` (keyless signing in the Action self-test) (Story 4.29).
- no workflow references TOKENHOUND_READ_TOKEN or GOPRIVATE (the benchmark lives in benchmark/ and builds TokenHound from the same checkout, so no private-module token or setup is needed) or a model provider credential (ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_OAUTH_TOKEN, OPENAI_API_KEY, CODEX_API_KEY), in any case: CI runs the coding-agent baseline only with the fake agent (Story 4.22);
- a job that runs in benchmark/ (a job or step working-directory of benchmark, or a run: script with -C benchmark or cd benchmark) checks out the full history (actions/checkout with fetch-depth: 0): the benchmark exports the TokenHound commit pinned in benchmark/tools.lock from the same clone, and on a shallow clone its tests skip instead of running (Story 4.22).
Each problem is reported as "file:line: message". With no arguments it checks .github/workflows/*.yml and *.yaml; with arguments it checks those files instead.
Usage: go run ./tools/workflowcheck [file ...]
Exit codes: 0 all workflows pass, 1 at least one problem, 2 the check could not run.