Skip to content

Commit e238411

Browse files
kotakanbeclaude
andauthored
ci(lint): add checks: write + fix path filter on actionlint workflow (#373)
Reworked from the original "create lint.yml" form (#373 v1) to a modification of the existing lint.yml that #370 introduced. Functional changes vs. main: 1. permissions: + `checks: write` — required for reviewdog's `github-pr-check` reporter to publish inline annotations via the Checks API. Without it, findings only show up in the run log, not on the PR diff (silent degradation). 2. paths filter: `.github/actions/**` → `.github/actionlint.yaml`. actionlint's default invocation does NOT lint composite actions under `.github/actions/`, so the previous filter triggered the workflow on changes that never affected lint output. The new filter tracks the actionlint config (which DOES affect lint results). 3. Documentation: caveats around `set -euo pipefail` × `$(... | jq ...)` exit-propagation gaps, composite-action coverage, and per-setting rationale. Synced from `vuls-saas/vuls-reach` PR #9. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 850b31f commit e238411

1 file changed

Lines changed: 37 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
name: Lint
22

3-
# Lint GitHub Actions workflows with actionlint (embeds shellcheck for `run:`
4-
# block bash). Catches GitHub Actions specific issues (deprecated actions,
5-
# unsafe `${{ ... }}` interpolation, missing permissions, stale runner labels)
6-
# plus shellcheck-detectable bash issues.
3+
# Lint GitHub Actions workflows with actionlint (which embeds shellcheck for
4+
# `run:` block bash). Coverage:
5+
# - GitHub Actions specific issues (unknown event types, deprecated actions,
6+
# missing required permissions, unsafe `${{ ... }}` interpolation in `run:`,
7+
# stale runner labels, etc.)
8+
# - Shellcheck rules on `run:` blocks (unquoted variables, glob misuse,
9+
# suspicious arithmetic, command substitution mistakes, etc.)
10+
#
11+
# Known *not* caught (still requires reviewer / Copilot eye):
12+
# - `set -euo pipefail` × `var=$(... | jq ...)` exit propagation when jq
13+
# parse fails on malformed JSON. Shellcheck does not model this control-
14+
# flow chain. We mitigate with `|| true` guards in the workflows that need
15+
# it (see comments in copilot-clean-label.yml stuck-detector for the
16+
# reference pattern).
17+
#
18+
# Scope: only runs when workflow files or actionlint config change. Cheap, and
19+
# avoids noise on non-CI PRs.
20+
#
21+
# Note: composite actions (.github/actions/) are NOT linted by actionlint's
22+
# default invocation. When composite actions are added, update actionlint_flags
23+
# to pass those paths explicitly.
724

825
on:
926
pull_request:
1027
paths:
1128
- '.github/workflows/**'
12-
- '.github/actions/**'
29+
- '.github/actionlint.yaml'
1330
push:
1431
branches: [main]
1532
paths:
1633
- '.github/workflows/**'
17-
- '.github/actions/**'
34+
- '.github/actionlint.yaml'
1835

1936
permissions: {}
2037

@@ -24,16 +41,29 @@ jobs:
2441
timeout-minutes: 3
2542
permissions:
2643
contents: read
44+
# `checks: write` is required for reviewdog's `github-pr-check` reporter
45+
# to post annotations via the Checks API. Without it, findings only
46+
# appear in the run log — not as inline annotations on the PR diff.
47+
checks: write
2748
pull-requests: read
2849
steps:
2950
- name: Checkout
3051
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3152

3253
- name: actionlint
33-
# Pinned to v1.72.0 SHA (released 2026-03-31). Bumps via dependabot.
54+
# Pin to v1.72.0 SHA (released 2026-03-31). Update manually or add a
55+
# `.github/dependabot.yml` entry for github-actions to automate bumps.
56+
# Wraps `rhysd/actionlint` v1.7.x which is the upstream linter.
3457
uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0
3558
with:
59+
# `github-pr-check` posts annotations on the PR diff via the Checks
60+
# API (requires `checks: write`, granted above). `level=error` makes
61+
# the check fail on any actionlint finding so the PR cannot merge
62+
# with lint failures.
3663
reporter: github-pr-check
3764
level: error
3865
fail_level: any
66+
# Pass `-color` for nicer terminal output in run logs. The action's
67+
# default rules are kept; project-specific suppressions go in
68+
# `.github/actionlint.yaml` (created only if needed).
3969
actionlint_flags: -color

0 commit comments

Comments
 (0)