Skip to content

Add actionlint to pre-commit - #68

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

Add actionlint to pre-commit#68
mattgodbolt merged 1 commit into
mainfrom
add-actionlint

Conversation

@mattgodbolt

Copy link
Copy Markdown
Member

First of a set of PRs adding actionlint across the CE repos — this repo first since workflows are the product here, and a generator bug fans out into ~95 files.

It statically checks every workflow: schema/typos, expression type-checking against real contexts (an if: referencing a job output or dispatch input that doesn't exist is an error, not a silent runtime false), reusable-workflow with: vs declared inputs, and shellcheck over run: scripts. It would have machine-verified the trickiest parts of #67.

  • Hook added to pre-commit (pre-commit auto-provisions the Go toolchain; CI already runs make pre-commit, so it's enforced there too).
  • .github/actionlint.yaml declares the self-hosted runner labels (ce, small, medium) so runs-on checking works.
  • Sole finding in the whole repo: SC2086 on the ce_install argument list in install-compilers.yml, where word-splitting is deliberate — annotated with a disable-and-reason rather than quoted (which would break it).

🤖 Generated with Claude Code

Statically checks all workflow files: schema, expression contexts (e.g.
a job output or input referenced in an if: must actually exist),
reusable-workflow call inputs, and shellcheck over run: scripts.
.github/actionlint.yaml declares our self-hosted runner labels.

The only finding across the ~95 workflows was SC2086 on ce_install's
argument list, where word-splitting is deliberate; annotated as such.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds actionlint to the repository’s pre-commit suite so GitHub Actions workflows are statically validated (workflow schema/expression checks and shellcheck over run: blocks), with repo-specific configuration for self-hosted runner labels.

Changes:

  • Add rhysd/actionlint as a pre-commit hook.
  • Add .github/actionlint.yaml to declare custom self-hosted runner labels for runs-on validation.
  • Suppress ShellCheck SC2086 for the intentional word-splitting in install-compilers.yml.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.pre-commit-config.yaml Adds the actionlint hook to the pre-commit pipeline.
.github/workflows/install-compilers.yml Documents intentional word-splitting with a targeted ShellCheck suppression.
.github/actionlint.yaml Configures actionlint with the repo’s self-hosted runner labels so runs-on checks succeed.

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

Comment thread .pre-commit-config.yaml
Comment on lines +13 to +16
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Declining — this is out of date: pre-commit auto-provisions a Go toolchain for language: golang hooks since pre-commit 3.0. Empirically verified while building this PR: the machine it was developed on has no go on PATH at all, and pre-commit run actionlint installed and built the hook fine (the downloaded toolchain lives in the hook's cached env). CI uses the same mechanism via make pre-commit, so nothing depends on runner images shipping Go.

This was referenced Jul 10, 2026
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>
@mattgodbolt
mattgodbolt merged commit b6e8ae4 into main Jul 12, 2026
3 checks passed
@mattgodbolt
mattgodbolt deleted the add-actionlint branch July 12, 2026 19:30
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