PreCommit hook with 'include' seems to always fire, not only for staged files #131
-
Hello, I'm trying to create a precommit hook to validate the renovate.json file. It should only fire if the renovate.json file is modified (because the validator is not super fast). {
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
"tasks": [
{
"group": "pre-commit",
"name": "validate-renovate-config",
"branch": "main|master",
"include": [
"renovate.json"
],
"filteringRule": "staged",
"command": "bash",
"args": [
"npx --yes --package renovate -- renovate-config-validator"
],
"windows": {
"command": "powershell",
"args": [
"-Command",
"npx --yes --package renovate -- renovate-config-validator"
]
}
},
{
"group": "commit-msg",
"name": "commit-message-linter",
"branch": "main|master",
"command": "dotnet",
"args": [
"husky",
"exec",
".husky/csx/commit-lint.csx",
"--args",
"${args}"
]
}
]
}
I think my hook file is not right and may be missing arguments? |
Beta Was this translation helpful? Give feedback.
Answered by
alirezanet
Mar 27, 2025
Replies: 1 comment 13 replies
-
@alirezanet Could you have a quick look? |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is the fix:
3241cbb