Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The new pre-commit/Go toolchain integration requires validation with an actual pre-commit client to confirm deletion-trigger behavior and networked build/runtime behavior, which the repository snapshot cannot exercise.
No open issues 🎉
What changed in this PR
Adds a pre-commit hook definition so repositories can automatically run gh-actions-lock when workflow files or actions.lock change.
Changes:
- Defines the
gh-actions-lockhook using pre-commit’s Go language environment. - Restricts execution to workflow YAML files and
.github/workflows/actions.lock. - Disables filename forwarding so the command scans the complete workflow set.
| File | Description |
|---|---|
| .pre-commit-hooks.yaml | Registers and configures the gh-actions-lock pre-commit hook, including its Go build environment, affected-file filter, and repository-wide execution behavior. |
Review effort: Lite (dynamic)
|
Ahh, didn't know There are two options:
For So
Since To ensure it doesn't run on any pre-commit invokation on the repo / any file change, we will need to check modified files and filter out But it's getting more involved:
Maybe for initial introduction of the hook it will be fine to use |
Adding a pre-commit hook, so users would be able to automatically ensure
actions.lockstays up to date by using hook below.It just runs
gh-actions-lockwhen one of the affected files is either yml file in.github/workflowsor if it'sactions.lockitself (typically pre-commit hooks don't verify, they just edit and then pre-commit detects that files are changes and aborts the operation).Also related to #266 - pre-commit hook versions are tracked by dependabot, so pre-commit users will stay up to date automatically. A bit hacky, but non-pre-commit users can also use .yml file as a version source for their
gh extension install github/gh-actions-lock --pin, until there will be better general solution for auto-updates.The hook is using
golangvalue forlangauge, so pre-commit will build it from source and then invoke it asgh-actions-lockexecutable. Tested this locally, build takes just 9 seconds without any cache, but with go preinstalled (if go isn't installed, pre-commit will pull the corresponding version to use for the build), so it should be fine.Some references: