Closed natterstefan closed 5 years ago
@natterstefan I remember using the prepare-commit-msg for exactly the reason you're describing above about wanting to enforce the users to enter a properly formatted commit message via commitizen.
Even though the prepare-commit-msg
hook isn't suppressed with the no-verify
option, maybe we can check if --no-verify
is also present, and give an exit code.
I'll take a look at it - in the meantime, something useful would be to generate a sandbox environment to make it easier for me to replicate the error
Hi @olgn, thanks for your response. Yes I can. I added a todo onto my list and let you know when it's ready. Should be simple and not complicated, but still I can't do it immediatelly.
@natterstefan thanks!
Hi @olgn, here's an example repository: https://github.com/natterstefan/example-commitizen-standard-version.
I've set up git-hooks (husky with prepare-commit-msg
), and standard-version (available with npm run release
and npm run release -- --no-verify
).
Hopefully this helps, if not let me know how I can be of help for you.
best, Stefan
Hi @olgn 👋,
were you able to take a look at the provided example already? Thank you for your help.
best, Stefan
Howdy @natterstefan - try this - Husky just put out a check for the HUSKY_SKIP_HOOKS
variable (issue here)- this will skip all husky hooks, which I think gets the bahaviour you would like.
package.json:
{
...
"scripts": {
....
"release": "HUSKY_SKIP_HOOKS=1 standard-version",
...
}
}
Please let me know how this works for you.
@olgn Awesome, it worked. Thanks for helping me!
@natterstefan happy to help.
@olgn Thank you!
HUSKY_SKIP_HOOKS
no longer works (as of at least 6.0.0). The HUSKY=0
variable should be now be used instead (see https://typicode.github.io/husky/#/?id=bypass-hooks).
Howdy @natterstefan - try this - Husky just put out a check for the
HUSKY_SKIP_HOOKS
variable (issue here)- this will skip all husky hooks, which I think gets the bahaviour you would like.package.json:
{ ... "scripts": { .... "release": "HUSKY_SKIP_HOOKS=1 standard-version", ... } }
Please let me know how this works for you.
Due to a breaking change in Huksy if the above does not work use
{
"scripts": {
"release": "HUSKY=0 standard-version",
}
}
Hi,
I have the following issue, which was somehow discussed in the PR of the feature "feat(cli): Implement --hook option for git hooks integration":
The Problem
When using the proposed hook solution together with husky, I am not able to skip the git hooks when using standard-version's release command (see command here).
What I do
Basically, this is what I have and do (used in my react-component-catalog package):
Whenever I release something, I execute one of these commands:
This results in the following error:
What I expect and need
I want to be able to use commitizen together with standard-version when creating a new release.
How? Either it would be great to tell the
git cz
command to skip interactive mode or entirely for this specific task, or I should use another hook (which I have not yet tested though).Whatever is better, I am happy if someone can assist me here. 👍
Hints, Links etc.
During my research I stumbled upon an issue raised in the husky package. He wanted to create "(...) a custom prepare-commit-msg hook that appends an ID to the commit msg." and also had troubles skipping it.
He got a response containing the following hint:
Because
prepare-commit-msg
does not allow--no-verify
...https://git-scm.com/docs/githooks#_prepare_commit_msg
Does that mean I should use
commit-msg
instead to make this work? But then people are not enforced anymore to use commitizen...Thank you for your help!