Skip to content

Add actionlint to pre-commit; fix what it found - #2226

Merged
mattgodbolt merged 1 commit into
mainfrom
add-actionlint
Jul 12, 2026
Merged

Add actionlint to pre-commit; fix what it found#2226
mattgodbolt merged 1 commit into
mainfrom
add-actionlint

Conversation

@mattgodbolt

Copy link
Copy Markdown
Member

Part of the actionlint rollout across CE repos (compiler-explorer/compiler-workflows#68 was first). actionlint statically checks workflow files for schema errors, expression-context mistakes (e.g. an if: referencing an input or job output that doesn't exist), workflow_call input wiring, unknown runner labels, and runs shellcheck over embedded run: scripts.

Setup

  • Pre-commit hook (rhysd/actionlint v1.7.12; pre-commit auto-provisions Go).
  • .github/actionlint.yaml declares our self-hosted labels (ce, small, medium, admin, lin-builder, win-builder).
  • Embedded-script shellcheck is gated to errors + warnings; info/style are ignored via config, consistent with (slightly stricter than) the repo's existing shellcheck --severity=error hook policy. That silenced 20 info/style nits rather than churning working scripts.

Real findings fixed

  • bespoke-build-arm64.yaml: latent bug — the image choice input defaulted to gcc, which isn't in its options list (only heaptrack is built for arm64). A gh/API dispatch relying on the default would try to run a nonexistent compilerexplorer/gcc-builder:latest-arm64 image. Default now heaptrack.
  • bespoke-build{,-arm64}.yaml: quoted $(pwd)/$(basename …) command substitutions (SC2046, warning level).
  • lin-lib-build.yaml / win-lib-build.yaml: removed default: from required workflow_call inputs — GitHub never uses a default on a required input, so this was dead config; all existing callers pass both values explicitly and are unaffected.

Pre-commit passes on all changed files.

🤖 Generated with Claude Code

actionlint statically checks the workflow files: schema, expression
contexts, workflow_call input wiring, runner labels (declared in
.github/actionlint.yaml), and shellcheck over run: scripts (gated to
errors+warnings; info/style ignored to match the shellcheck hook's
severity philosophy).

Findings fixed:
- bespoke-build-arm64: the default image "gcc" wasn't in the options
  list (only heaptrack is built for arm64), so API dispatches relying
  on the default named a nonexistent image.
- bespoke-build{,-arm64}: quote $(pwd)/$(basename ...) command
  substitutions (SC2046).
- lin/win-lib-build: drop `default` from required workflow_call inputs
  — a required input's default can never be used, so this is dead
  config; no caller behaviour changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 10, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the actionlint rollout by adding rhysd/actionlint to pre-commit, introducing a repository actionlint configuration (including recognized self-hosted runner labels and shellcheck severity filtering), and applying the resulting workflow fixes to keep GitHub Actions YAML/schema and embedded shell scripts clean.

Changes:

  • Added an actionlint pre-commit hook (v1.7.12).
  • Added .github/actionlint.yaml to declare self-hosted runner labels and ignore shellcheck info/style findings in embedded run: scripts.
  • Fixed workflows based on actionlint findings (arm64 image default, quoting for command substitutions, and removal of redundant defaults on required workflow_call inputs).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.pre-commit-config.yaml Adds actionlint to the pre-commit hook set to statically validate workflow files.
.github/workflows/win-lib-build.yaml Removes default: from required workflow_call inputs to eliminate dead/unused configuration.
.github/workflows/lin-lib-build.yaml Removes default: from required workflow_call inputs to eliminate dead/unused configuration.
.github/workflows/bespoke-build.yaml Quotes command substitutions in docker run volume mount and GITHUB_OUTPUT writes to satisfy shellcheck/actionlint.
.github/workflows/bespoke-build-arm64.yaml Fixes invalid image default to heaptrack and applies the same shell quoting improvements as the x64 workflow.
.github/actionlint.yaml Configures actionlint with known self-hosted runner labels and shellcheck ignore patterns for info/style severities.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This was referenced Jul 10, 2026
@mattgodbolt
mattgodbolt merged commit 6826d91 into main Jul 12, 2026
2 checks passed
@mattgodbolt
mattgodbolt deleted the add-actionlint branch July 12, 2026 19:20
mattgodbolt added a commit to compiler-explorer/compiler-explorer that referenced this pull request Jul 12, 2026
Part of the actionlint rollout across CE repos
(compiler-explorer/compiler-workflows#68, compiler-explorer/infra#2226).
[actionlint](https://github.com/rhysd/actionlint) statically checks
workflow files: schema/typos, expression type-checking against real
contexts (undefined inputs/outputs/needs are errors), unknown runner
labels, and shellcheck over embedded `run:` scripts.

This repo has no pre-commit framework, so it's wired as a small CI
workflow that runs on any push/PR touching `.github/workflows/**`, using
the pinned official docker image. `.github/actionlint.yaml` declares the
self-hosted `admin` label so `runs-on: [admin]` (deploy workflows)
checks correctly.

The existing ten workflows already pass with no findings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants