Skip to content

feat(workspace): ship the actionlint hook and its label config to consumers - #1661

Merged
c-vigo merged 7 commits into
devfrom
feature/1660-managed-actionlint-config
Sep 21, 2026
Merged

c-vigo merged 7 commits into
devfrom
feature/1660-managed-actionlint-config

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Description

Ships the actionlint GitHub Actions workflow linter to consumers: the prek hook that runs it, plus the .github/actionlint.yaml label config it needs.

actionlint has been in the vigOS toolchain since #995 — nix/devtools.nix, so it is on PATH in the dev-shell, the image and the vigos.packages home module — but the hook that runs it was devkit-only. Consumers therefore shipped workflows that nothing ever linted: a survey of vig-os, exo-pet, MorePET and exoma-ch found no actionlint hook, CI step or justfile recipe in any repo. shellcheck is the precedent this follows: same toolchain SSoT (nix/devtools.nix), same language: system form, already shipped to consumers.

The hook needs a companion. actionlint rejects any literal runs-on: label missing from its built-in list, and only an actionlint.yaml declaring self-hosted-runner.labels can teach it one. The baseline is ubuntu-26.04 / ubuntu-26.04-arm: real hosted runners (PR #1658's build job ran on Image: ubuntu-26.04 / 20260907.131.1 and passed) that actionlint 1.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 how DEVKIT_CI_RUNNER (#1173) reaches runs-on, is skipped by actionlint entirely (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 feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • nix/hooks.nix — scaffold = true on the actionlint hookDef. The two committed .pre-commit-config.yaml files are renders of this one definition and are drift-gated by tests/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 with nix/hooks.nix.
  • assets/init-workspace.sh — .github/actionlint.yaml joins PRESERVE_FILES (consumer owns their label declarations, same class as .yamllint/.pymarkdown/.typos.toml); new actionlint group in VALID_FEATURES + feature_paths(); new render_actionlint_optout() excising the hook block when the group is disabled, wired in after the sibling .pre-commit-config.yaml renders.
  • 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 .devcontainer mirror) — ## Unreleased entry.
  • tests/bats/init-workspace.bats — 7 new tests (see Testing).

Note the banner on the shipped config is not hand-written: sync_manifest.py derives managed-vs-preserved from PRESERVE_FILES, so adding the path flips it to the "yours to edit; upgrades never overwrite this file" variant automatically.

Changelog Entry

Added

  • Consumers get the actionlint workflow linter, hook and label config
    (#1660)
    • actionlint has shipped in the toolchain since Adopt actionlint for authored and per-mode rendered workflow templates #995, but the hook that runs
      it was devkit-only — so a consumer's GitHub Actions workflows were linted by
      nothing. The scaffold now carries the hook, in the same language: system
      form as shellcheck (both resolve from the flake toolchain, so both work in
      every mode).
    • New .github/actionlint.yaml declares the runner labels actionlint's
      built-in list does not know. It ships with the ubuntu-26.04 /
      ubuntu-26.04-arm baseline: real hosted runners that actionlint 1.7.12 —
      the latest release — predates. Labels reaching runs-on through an
      expression (DEVKIT_CI_RUNNER via fromJSON) are invisible to actionlint
      and need no entry.
    • The config is yours to edit: it joins the preserve list beside
      .yamllint / .pymarkdown / .typos.toml, so a repo can declare its own
      literal self-hosted label and keep it across upgrades.
    • New actionlint group for DEVKIT_FEATURES_DISABLED opts out of both
      halves at once; an existing config is preserved-class and left in place.
    • Existing repos keep their preserved .pre-commit-config.yaml untouched: the
      new 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

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

Full local verification on the committed branch:

Gate Result
prek run --all-files (full suite, re-run after the dev merge) exit 0, no failures
pytest (192 deselected: test_image / test_integration) 1649 passed, 1 skipped
tests/bats/init-workspace.bats 296/296
11 other bats suites 249/249
tests/test_flake_hooks.py (hook drift gate) 74/74

test_image / test_integration were deselected deliberately — they fail locally off a lagging :dev image 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.04 baseline; the preserved banner plus a consumer edit surviving an upgrade; DEVKIT_FEATURES_DISABLED=actionlint shipping 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 actionlint tests (devcontainer, direnv, bare, both, trunk, mirror) already execute exactly what the hook runs — actionlint with pass_filenames: false over each rendered tree — so the hook's green path is covered per mode, not merely its presence.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Scope history. The issue began as "hold the ubuntu-26.04 bump" and was rescoped twice; both turns are recorded on #1660. One claim in an earlier revision — that DEVKIT_CI_RUNNER leaves consumers with an unfixable runner-label failure — was false and is retracted there: those labels reach runs-on only through ${{ fromJSON(...) }}, which actionlint never inspects.

Dropped from scope after the config became consumer-owned (recorded on the issue): DEVKIT_ACTIONLINT_LABELS and a DEVKIT_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 #1640 render_refs_policy anchored-idempotent-sed pattern — was rejected as contradicting consumer overriding.

Adoption is new-repos-only. .pre-commit-config.yaml is preserved, so existing consumers do not receive the hook on upgrade; it surfaces through the #878 print_preserved_template_diff to 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 ubuntu v24 → v26) should be rebased once this merges; both gates — actionlint over .github/workflows/ and the 7 rendered-template bats tests — should then clear.

Refs: #1660

…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
@c-vigo c-vigo self-assigned this Sep 21, 2026
@c-vigo
c-vigo enabled auto-merge September 21, 2026 08:07
@c-vigo
c-vigo merged commit 43cce74 into dev Sep 21, 2026
14 checks passed
@c-vigo
c-vigo deleted the feature/1660-managed-actionlint-config branch September 21, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant