Repository navigation
feat(workspace): ship the actionlint hook and its label config to consumers - #1661
Merged
Merged
Conversation
…sumers actionlint has been on PATH in every consumer environment since #995 (nix/devtools.nix — dev-shell, image, vigos.packages), exactly like shellcheck, but no hook ran it: a consumer's workflows were linted by nothing. Add scaffold = true to the actionlint hookDef so the one definition in nix/hooks.nix renders it into the scaffold config too. The hook needs a companion. actionlint rejects any LITERAL runs-on label missing from its built-in list, and only self-hosted-runner.labels can teach it one; expression forms are skipped, so DEVKIT_CI_RUNNER reaching runs-on via fromJSON needs no entry. Ship .github/actionlint.yaml with the ubuntu-26.04 baseline — a live hosted runner that actionlint 1.7.12 (latest release, 2026-03-30) predates — and add devkit's own copy, since its workflows are not scaffolded. Adoption is new-repos-only: .pre-commit-config.yaml is preserved, so an existing consumer meets the hook through the #878 template diff. Refs: #1660
The actionlint config is the only place a repo can declare a literal runs-on label actionlint's built-in list rejects, so a consumer naming their own self-hosted label must be able to add it and keep it. Join .github/actionlint.yaml to PRESERVE_FILES, the same class as .yamllint/.pymarkdown/.typos.toml: upgrades never overwrite it, and the #878 template diff keeps a new baseline label visible. The provenance-banner pass derives managed-vs-preserved from PRESERVE_FILES, so the file now carries the "yours to edit" banner instead of the managed one — whose "customize in justfile.project" was doubly wrong here: there is no justfile route to an actionlint label, and the edits are not lost. Refs: #1660
New `actionlint` group for DEVKIT_FEATURES_DISABLED. It has to take both halves: a repo left with the hook but no label config would lint against actionlint's bare built-in list and fail on any runner label the scaffold renders that it does not know. The label config is an ordinary feature_paths entry, so the existing copy-exclude, prune and --preview classifier handle it (preserved-class, so an existing one is reported left-in-place rather than deleted). The hook cannot be: it lives inside the preserved .pre-commit-config.yaml, which no path prune reaches. The template therefore brackets the block with `# >>> devkit:actionlint` sentinels and render_actionlint_optout deletes that range — comments are invisible to the data-level drift gate, so the markers stay in step with nix/hooks.nix while giving the excision an exact range instead of a structural guess at where the block ends. Guarded rather than unconditional, unlike the sibling renders: this removes instead of substituting, so there is no value to rewrite each run, and clearing the key restores the hook from the template copy. Refs: #1660
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.
Description
Ships the
actionlintGitHub Actions workflow linter to consumers: the prek hook that runs it, plus the.github/actionlint.yamllabel config it needs.actionlinthas been in the vigOS toolchain since #995 —nix/devtools.nix, so it is onPATHin the dev-shell, the image and thevigos.packageshome module — but the hook that runs it was devkit-only. Consumers therefore shipped workflows that nothing ever linted: a survey ofvig-os,exo-pet,MorePETandexoma-chfound noactionlinthook, CI step or justfile recipe in any repo.shellcheckis the precedent this follows: same toolchain SSoT (nix/devtools.nix), samelanguage: systemform, already shipped to consumers.The hook needs a companion.
actionlintrejects any literalruns-on:label missing from its built-in list, and only anactionlint.yamldeclaringself-hosted-runner.labelscan teach it one. The baseline isubuntu-26.04/ubuntu-26.04-arm: real hosted runners (PR #1658's build job ran onImage: ubuntu-26.04/20260907.131.1and passed) thatactionlint1.7.12 — the latest upstream release, published 2026-03-30 — predates, so no pin bump recognises them.Expression forms need no entry:
runs-on: ${{ fromJSON(...) }}, which is howDEVKIT_CI_RUNNER(#1173) reachesruns-on, is skipped byactionlintentirely (verified directly).This unblocks #1658, whose 43
[runner-label]findings and 7 failing rendered-template bats tests cannot clear without it.Type of Change
feat-- New featurefix-- Bug fixdocs-- Documentation onlychore-- Maintenance task (deps, config, etc.)refactor-- Code restructuring (no behavior change)test-- Adding or updating testsci-- CI/CD pipeline changesbuild-- Build system or dependency changesrevert-- Reverts a previous commitstyle-- Code style (formatting, whitespace)Modifiers
!) -- This change breaks backward compatibilityChanges Made
nix/hooks.nix—scaffold = trueon theactionlinthookDef. The two committed.pre-commit-config.yamlfiles are renders of this one definition and are drift-gated bytests/test_flake_hooks.py, so this is the only correct place to add the hook; the comment explaining the old devkit-only scoping is rewritten (the "wrong reusable-workflow root" objection applies to linting templates in-place inside devkit, not to a real consumer repo).assets/workspace/.github/actionlint.yaml(new) — the shipped label config, with each baseline label carrying its reason and a delete-when condition inline..github/actionlint.yaml(new) — devkit's own copy; its workflows are not scaffolded, so it needs one.assets/workspace/.pre-commit-config.yaml— the rendered hook block, bracketed by# >>> devkit:actionlint/# <<<sentinels. The drift gate compares parsed YAML, so comments are invisible to it: the markers give the opt-out an exact excision range while staying in step withnix/hooks.nix.assets/init-workspace.sh—.github/actionlint.yamljoinsPRESERVE_FILES(consumer owns their label declarations, same class as.yamllint/.pymarkdown/.typos.toml); newactionlintgroup inVALID_FEATURES+feature_paths(); newrender_actionlint_optout()excising the hook block when the group is disabled, wired in after the sibling.pre-commit-config.yamlrenders.assets/workspace/.vig-os,docs/MIGRATION.md— the new group documented in the knob comment and the feature-group list (now nine), plus the preserved-class caveat.CHANGELOG.md(+ synced.devcontainermirror) —## Unreleasedentry.tests/bats/init-workspace.bats— 7 new tests (see Testing).Note the banner on the shipped config is not hand-written:
sync_manifest.pyderives managed-vs-preserved fromPRESERVE_FILES, so adding the path flips it to the "yours to edit; upgrades never overwrite this file" variant automatically.Changelog Entry
Added
actionlintworkflow linter, hook and label config(#1660)
actionlinthas shipped in the toolchain since Adopt actionlint for authored and per-mode rendered workflow templates #995, but the hook that runsit was devkit-only — so a consumer's GitHub Actions workflows were linted by
nothing. The scaffold now carries the hook, in the same
language: systemform as
shellcheck(both resolve from the flake toolchain, so both work inevery mode).
.github/actionlint.yamldeclares the runner labels actionlint'sbuilt-in list does not know. It ships with the
ubuntu-26.04/ubuntu-26.04-armbaseline: real hosted runners that actionlint 1.7.12 —the latest release — predates. Labels reaching
runs-onthrough anexpression (
DEVKIT_CI_RUNNERviafromJSON) are invisible to actionlintand need no entry.
.yamllint/.pymarkdown/.typos.toml, so a repo can declare its ownliteral self-hosted label and keep it across upgrades.
actionlintgroup forDEVKIT_FEATURES_DISABLEDopts out of bothhalves at once; an existing config is preserved-class and left in place.
.pre-commit-config.yamluntouched: thenew hook surfaces through the fix(workspace): scaffold upgrade replaces .pre-commit-config.yaml, silently clobbering repo-specific hook config #878 template diff on upgrade, to fold in by
hand.
Testing
just test)Manual Testing Details
Full local verification on the committed branch:
prek run --all-files(full suite, re-run after thedevmerge)pytest(192 deselected:test_image/test_integration)tests/bats/init-workspace.batstests/test_flake_hooks.py(hook drift gate)test_image/test_integrationwere deselected deliberately — they fail locally off a lagging:devimage rather than off the branch, so CI is the right place for them.New bats coverage (7 tests): hook present in a fresh scaffold; config present; the
ubuntu-26.04baseline; the preserved banner plus a consumer edit surviving an upgrade;DEVKIT_FEATURES_DISABLED=actionlintshipping neither half; the excision leaving the neighbouring hooks intact and the config still parsing; an existing config left in place by the opt-out.The pre-existing 6 rendered-mode
actionlinttests (devcontainer, direnv, bare, both, trunk, mirror) already execute exactly what the hook runs —actionlintwithpass_filenames: falseover each rendered tree — so the hook's green path is covered per mode, not merely its presence.Checklist
docs/templates/, then runjust docs)CHANGELOG.mdin the[Unreleased]section (and pasted the entry above)Additional Notes
Scope history. The issue began as "hold the
ubuntu-26.04bump" and was rescoped twice; both turns are recorded on #1660. One claim in an earlier revision — thatDEVKIT_CI_RUNNERleaves consumers with an unfixablerunner-labelfailure — was false and is retracted there: those labels reachruns-ononly through${{ fromJSON(...) }}, which actionlint never inspects.Dropped from scope after the config became consumer-owned (recorded on the issue):
DEVKIT_ACTIONLINT_LABELSand aDEVKIT_CI_RUNNER→ label derivation. A preserved file is not re-rendered on upgrade, so such a knob would apply only at first scaffold and silently do nothing afterwards; the consumer edits the file directly instead. The alternative that would have justified them — a managed file with the #1640render_refs_policyanchored-idempotent-sed pattern — was rejected as contradicting consumer overriding.Adoption is new-repos-only.
.pre-commit-config.yamlis preserved, so existing consumers do not receive the hook on upgrade; it surfaces through the #878print_preserved_template_diffto fold in by hand. This follows the split #1652's own table documents: that table is for blocks the template retired because they break, "never for ordinary drift", and it names the #878 diff as the right tool for "a new hook was added".Follow-up: #1658 (Renovate
ubuntuv24 → v26) should be rebased once this merges; both gates —actionlintover.github/workflows/and the 7 rendered-template bats tests — should then clear.Refs: #1660