Skip to content

Commit 084147d

Browse files
ci: lint workflow files with actionlint
Add a dedicated workflow that runs actionlint on `.github/workflows/**`. It catches what plain YAML validity doesn't — undefined `needs`/job references, malformed `${{ }}` expressions, unknown action inputs, and (via shellcheck) issues in `run:` scripts. A dead `needs:` reference previously shipped because nothing guarded the workflows themselves.
1 parent 3d7fa5b commit 084147d

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint Workflows
2+
3+
# Lint the workflow files themselves. actionlint catches what YAML validity can't:
4+
# undefined `needs`/job references, bad `${{ }}` expressions, unknown action inputs,
5+
# and (via its shellcheck integration) shell issues in `run:` blocks. A broken
6+
# `needs:` reference once shipped silently because nothing here guarded it.
7+
on:
8+
pull_request:
9+
paths:
10+
- '.github/workflows/**'
11+
push:
12+
branches: [main]
13+
paths:
14+
- '.github/workflows/**'
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
actionlint:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
24+
25+
- name: Install actionlint
26+
# Pinned by version; the download is verified against the release's own
27+
# published checksums. taiki-e/install-action doesn't carry actionlint, and
28+
# curl|bash of an upstream script pins nothing — this does both.
29+
env:
30+
ACTIONLINT_VERSION: 1.7.12
31+
run: |
32+
base="https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}"
33+
curl -fsSL "${base}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" -o actionlint.tar.gz
34+
curl -fsSL "${base}/actionlint_${ACTIONLINT_VERSION}_checksums.txt" -o checksums.txt
35+
grep "actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" checksums.txt | sha256sum -c -
36+
tar -xzf actionlint.tar.gz actionlint
37+
install -m 0755 actionlint /usr/local/bin/actionlint
38+
rm -f actionlint actionlint.tar.gz checksums.txt
39+
40+
# shellcheck ships on the runner, so actionlint also lints embedded `run:`
41+
# scripts. -color for readable annotations in the job log.
42+
- name: Run actionlint
43+
run: actionlint -color

0 commit comments

Comments
 (0)