Disable actionlint hook by default when running pre-commit locally#15061
Merged
AlexWaygood merged 2 commits intomainfrom Dec 19, 2024
Merged
Disable actionlint hook by default when running pre-commit locally#15061AlexWaygood merged 2 commits intomainfrom
AlexWaygood merged 2 commits intomainfrom
Conversation
MichaReiser
approved these changes
Dec 19, 2024
| echo '```console' > "$GITHUB_STEP_SUMMARY" | ||
| # Enable color output for pre-commit and remove it for the summary | ||
| SKIP=cargo-fmt,clippy,dev-generate-all pre-commit run --all-files --show-diff-on-failure --color=always | \ | ||
| SKIP=cargo-fmt,clippy,dev-generate-all pre-commit run --all-files --show-diff-on-failure --color=always --hook-stage=manual | \ |
Member
There was a problem hiding this comment.
Nit: It wasn't very clear to me what manual means. What would you think of renaming it to CI?
Member
Author
There was a problem hiding this comment.
Unfortunately this is out of my control 😆 it has to be one of git's recognised hook stages or manual: https://pre-commit.com/#confining-hooks-to-run-at-certain-stages
Member
Author
There was a problem hiding this comment.
I'll add a comment to this workflow file, though
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We added actionlint as a pre-commit hook in #15021. Unfortunately, it's by far the slowest hook in our pre-commit config, so this now makes running
uvx pre-commit run -alocally quite slow.This PR tweaks our pre-commit config so that it will now be disabled by default when running pre-commit locally but will be enabled when pre-commit is run in CI. This is achieved by reworking the hook entry so that it is only run when
--hook-stage=manualis specified on the command line.Test Plan
The hook now runs instantaneously when
uvx pre-commit run -ais invoked for me locally (because it is skipped), but still picks up errors in GitHub Actions workflows when--hook-stage=manualis specified. I also checked the exact command we'll be running in.github/workflows/ci.yaml, and actionlint correctly flags issues locally when that command is run.