Skip to content

Commit 49f1245

Browse files
feat: add actionlint to CI and pre-commit for workflow validation (#89)
* feat: add actionlint to CI and pre-commit for workflow validation Add actionlint step to the Code Quality CI workflow using SHA-pinned raven-actions/actionlint action (v2.1.2, actionlint 1.7.12). Add actionlint hook to .pre-commit-config.yaml with files filter for .github/workflows/. Document actionlint in CONTRIBUTING.md under Pre-commit hooks and Linting sections. Ref: RHAIENG-4067 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: remove redundant manual linter instructions from CONTRIBUTING The Linting section duplicated install/run instructions already covered by the Pre-commit hooks section. Replace with a reference to pre-commit hooks and a config file summary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 615c91e commit 49f1245

3 files changed

Lines changed: 20 additions & 23 deletions

File tree

.github/workflows/code-quality.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
run: ruff format --check .
3939

4040
- name: Markdownlint
41+
# v23.0.0 bundles markdownlint-cli2 0.22.1 — keep in sync with .pre-commit-config.yaml
4142
uses: DavidAnson/markdownlint-cli2-action@ce4853d43830c74c1753b39f3cf40f71c2031eb9 # v23.0.0
4243
with:
4344
globs: "**/*.md"
45+
46+
- name: Actionlint
47+
# shellcheck is pre-installed on ubuntu-latest, so run: steps are also linted
48+
uses: raven-actions/actionlint@205b530c5d9fa8f44ae9ed59f341a0db994aa6f8 # v2.1.2
49+
with:
50+
version: 1.7.12

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ repos:
5858
hooks:
5959
- id: markdownlint-cli2
6060
args: [--fix]
61+
62+
# Actionlint — GitHub Actions workflow validation
63+
# Keep version in sync with raven-actions/actionlint in .github/workflows/code-quality.yml
64+
- repo: https://github.com/rhysd/actionlint
65+
rev: v1.7.12
66+
hooks:
67+
- id: actionlint
68+
files: ^\.github/workflows/

CONTRIBUTING.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,15 @@ General-purpose checks from [pre-commit/pre-commit-hooks](https://github.com/pre
6969
| `no-commit-to-branch` | Blocks direct commits to `main` |
7070
| `detect-private-key` | Catches accidentally committed private keys |
7171

72-
## Linting and formatting
73-
74-
This project uses [ruff](https://docs.astral.sh/ruff/) for Python linting and formatting, and [markdownlint](https://github.com/DavidAnson/markdownlint) for Markdown linting. Both run as blocking CI checks on all pull requests via the `Code Quality` workflow.
75-
76-
### Python (ruff)
72+
### GitHub Actions workflow validation (actionlint)
7773

78-
Run locally before pushing:
79-
80-
```bash
81-
uv tool install ruff==0.15.11
82-
ruff check . # lint
83-
ruff format --check . # format check
84-
ruff format . # auto-format
85-
```
74+
Validates `.github/workflows/` files using [actionlint](https://github.com/rhysd/actionlint). Only runs when workflow files are staged.
8675

87-
Configuration is in [`ruff.toml`](ruff.toml) at the repo root.
88-
89-
### Markdown (markdownlint)
90-
91-
Run locally before pushing:
76+
## Linting and formatting
9277

93-
```bash
94-
npx markdownlint-cli2@0.22.1 "**/*.md" # lint
95-
npx markdownlint-cli2@0.22.1 --fix "**/*.md" # auto-fix
96-
```
78+
This project uses [ruff](https://docs.astral.sh/ruff/) for Python linting and formatting, [markdownlint](https://github.com/DavidAnson/markdownlint) for Markdown linting, and [actionlint](https://github.com/rhysd/actionlint) for GitHub Actions workflow validation. All three run as blocking CI checks on every pull request via the `Code Quality` workflow, and locally via the [pre-commit hooks](#pre-commit-hooks) described above.
9779

98-
Configuration is in [`.markdownlint.jsonc`](.markdownlint.jsonc) (rules) and [`.markdownlint-cli2.yaml`](.markdownlint-cli2.yaml) (ignored paths) at the repo root.
80+
Configuration files: [`ruff.toml`](ruff.toml) (Python rules), [`.markdownlint.jsonc`](.markdownlint.jsonc) (Markdown rules), [`.markdownlint-cli2.yaml`](.markdownlint-cli2.yaml) (ignored paths).
9981

10082
## Commit message conventions
10183

0 commit comments

Comments
 (0)