Repository navigation
Run each linter as its own CI check, add actionlint and zizmor - #371
Merged
Merged
Conversation
sebsgent
commented
Dec 1, 2026
sebsgent
left a comment
Contributor
Author
There was a problem hiding this comment.
No must-fix or should-fix items. The change is correct and complete.
Before release:
- After merging, run "bitcoinix docs" once via
workflow_dispatchon master. Theupload-pages-artifactpath (${{ runner.temp }}/site) and the master fetch without credentials only run outside PRs. Scheduled tag checks don't trigger a docs build, so otherwise the next release would be their first run. A manual run redeploys the latest release (v0.2.1).
Optional:
- On every commit, even when nothing fails, the hook prints zizmor's progress log: 7 INFO lines, a WARN about the
pythonshell inpr-size.yml, and a "No findings" line. dev/README.mdsays the hook lints "the staged files". It lints the whole staged tree, so a finding in a file the commit doesn't touch also blocks the commit.
Tested:
- Each linter fails on an injected violation: actionlint (undefined context), deadnix (unused let), shellcheck (SC2154 in an extensionless shebang file), statix (
manual_inherit), zizmor (artipacked). - The shellcheck file selection matches the old
test/shellcheck.shexactly (43 files). - The pre-commit hook checks the index, not the working tree. It fails with
git commit -aand withgit commit -- <path>, warns whentest/lint.nixhas changed, and works in a linked worktree. - The install command refuses to overwrite an existing hook file, replaces its own symlink, and follows
core.hooksPath. ./test/run-tests.sh lintpasses.- All 12 checkouts set
persist-credentials: false. Anonymous access to the public repo works for the remaininggit fetchcalls.
Assisted-by: Claude Code (Claude Opus 5.5)
Contributor
|
Reviewed head No actionable findings. The linter matrix, flake checks, and required CI gate are consistent. The earlier optional comments about noisy successful hooks and the staged-tree wording are addressed in this head. Validation on
GitHub CI is green for this head. The live Pages deployment path was inspected but not executed locally. |
seberm
approved these changes
Dec 1, 2026
Check out without persisting the GitHub token in .git/config (`persist-credentials: false`). No job needs it: the only git operations after checkout fetch from the public repository. Grant the labeler's pull-requests write permission per job instead of for the whole workflow. Pass the docs site directory to upload-pages-artifact directly instead of through GITHUB_ENV. Document why the pull_request_target and workflow_run triggers are safe, and mark them as accepted zizmor findings: the labeler only calls the GitHub API, pr-size only diffs the PR head in a bare repository, and the docs release build runs only after "Verify release tags", with the workflow and tooling of the default branch. Assisted-by: Claude Code (claude-opus-5-5)
Define the linters once in test/lint.nix: actionlint, deadnix, shellcheck, statix and zizmor (offline audits only). Each linter is a flake check and a job of the `lint` CI matrix, reported as `lint (<linter>)`, so a failing linter shows up without opening the logs. The matrix replaces the shellcheck job, and test/shellcheck.sh moves into lint.nix. The ci-workflows check requires the matrix to list exactly the linters of lint.nix. `./test/run-tests.sh lint` (replacing the `shellcheck` target) runs all linters locally, and `nix develop` provides them. Add an optional pre-commit hook, `.#pre-commit-hook`, that runs the same linters on the staged tree. It runs the linters of the checkout it was installed from, so checking out untrusted code doesn't change what it runs, and warns when test/lint.nix has changed since. Assisted-by: Claude Code (claude-opus-5-5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #370, as announced there.
Changes
test/lint.nixdefines the linters once: actionlint, deadnix, shellcheck, statix and zizmor (offline audits only). Each is a flake check and a job of a newlintCI matrix, reported aslint (<linter>). The matrix replaces theshellcheckjob, andtest/shellcheck.shmoves intolint.nix.ci-workflowscheck requires the matrix to list exactly the linters oflint.nix, andlintis inci_gate'sneeds../test/run-tests.sh lint(replaces theshellchecktarget), and all linters are innix develop..#pre-commit-hook: it runs the same linters on the whole staged tree, so a finding in any file blocks the commit, and prints only the output of failing linters. It keeps running the linters of the checkout it was installed from, so checking out untrusted code doesn't change what it runs, and it warns whentest/lint.nixhas changed since. Installing and removing it is described indev/README.md.persist-credentials: falseon every checkout. The only git operations after checkout fetch from the public repository.pull-requests: writepermission is granted per job instead of for the whole workflow.upload-pages-artifactdirectly instead of throughGITHUB_ENV.pull_request_target(labeler, pr-size) andworkflow_run(docs) triggers are kept, with a comment explaining why each is safe and# zizmor: ignore[dangerous-triggers].nixfmt still comes later, in its own formatting-only PR.
Testing
ci-workflowsand the pre-commit hook build and pass locally, and the hook passes on the staged tree.persist-credentials: falsefrom a checkout makes the zizmor check and the hook fail (artipacked). A passing hook prints nothing.lintmatrix,nix flake checkand VM scenarios are left to CI.Assisted-by: Claude Code (claude-opus-5-5)