-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add actionlint
as a pre-commit hook (with shellcheck integration)
#15021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Configuration for the actionlint tool, which we run via pre-commit | ||
# to verify the correctness of the syntax in our GitHub Actions workflows. | ||
|
||
self-hosted-runner: | ||
# Various runners we use that aren't recognized out-of-the-box by actionlint: | ||
labels: | ||
- depot-ubuntu-latest-8 | ||
- depot-ubuntu-22.04-16 | ||
- windows-latest-xlarge |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ jobs: | |
run: cargo build --locked | ||
- name: Fuzz | ||
run: | | ||
# shellcheck disable=SC2046 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be ok to quote this: "$(shuf ...)" Although I don't really have a linux machine to test. I'd be fine to ignore this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked it on my Mac, and the command copied-and-pasted into my shell works as it currently is on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, let's keep it disabled then. Thanks for testing it. |
||
( | ||
uvx \ | ||
--python=3.12 \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,5 +101,23 @@ repos: | |
hooks: | ||
- id: check-github-workflows | ||
|
||
# `actionlint` hook, for verifying correct syntax in GitHub Actions workflows. | ||
# Some additional configuration for `actionlint` can be found in `.github/actionlint.yaml`. | ||
- repo: https://github.com/rhysd/actionlint | ||
rev: v1.7.4 | ||
hooks: | ||
- id: actionlint | ||
# `release.yml` is autogenerated by `dist`; issues need to be fixed there | ||
# (https://opensource.axo.dev/cargo-dist/) | ||
exclude: .github/workflows/release.yml | ||
args: | ||
- "-ignore=SC2129" # ignorable stylistic lint from shellcheck | ||
- "-ignore=SC2016" # another shellcheck lint: seems to have false positives? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you provide the case where it's giving false positive? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the report:
they might be fixable? Not sure. I don't think there's an actual bug on those lines anyway. We could just put inline ignore comments on those lines? But that specific check didn't seem to actually flag any real issues in our shell scripts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right, I think the one in $ gh pr list --state open --json title --jq ".[] | select(.title == ${pull_request_title}) | .number"
failed to parse jq expression (line 1, column 35)
.[] | select(.title == [red-knot] Statically known branches) | .number
^ unexpected token "Statically" Let's ignore this for now as we know it's already working. |
||
additional_dependencies: | ||
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions | ||
# and checks these with shellcheck. This is arguably its most useful feature, | ||
# but the integration only works if shellcheck is installed | ||
- "github.com/wasilibs/go-shellcheck/cmd/[email protected]" | ||
|
||
ci: | ||
skip: [cargo-fmt, dev-generate-all] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might actually be ok to quote but it's ok for now to disable this as we might need to test this a bit to verify.
But, the other one is probably correct to ignore because it contains glob
*
character.