feat(lint-staged): better branch commit message policy

Related to 56b9d22d4
This commit is contained in:
Julien Fontanet 2023-03-09 12:43:33 +01:00
parent 56b9d22d49
commit 586b84f434

View File

@ -1,4 +1,11 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit "$1"
# Only check commit message if commit on master or first commit on another
# branch to avoid bothering fix commits after reviews
#
# FIXME: does not properly run with git commit --amend
if [ "$(git rev-parse --abbrev-ref HEAD)" = master ] || [ "$(git rev-list --count master..)" -eq 0 ]
then
npx --no -- commitlint --edit "$1"
fi