Add script to check commit message style
This commit is contained in:
parent
0c9c9e26c1
commit
8832a17f12
1 changed files with 25 additions and 0 deletions
25
scripts/hooks/commit-msg.checkstyle.sh
Normal file
25
scripts/hooks/commit-msg.checkstyle.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# An hook script to check the commit message for style
|
||||
#
|
||||
# To enable this hook, copy this file to ".git/hooks/commit-msg" and make it
|
||||
# executable.
|
||||
|
||||
. git-sh-setup
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# Check for "WIP" in commit message and add "[skip ci]" if commit message
|
||||
# contains a WIP.
|
||||
#
|
||||
#
|
||||
|
||||
if grep -q -i -e "WIP" -e "work in progress" $1; then
|
||||
read -p "You're about to add a WIP commit, do you want to run the CI? [y|n] " -n 1 -r < /dev/tty
|
||||
echo
|
||||
if echo $REPLY | grep -E '^[Nn]$' > /dev/null; then
|
||||
echo "[skip ci]" >> $1
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in a new issue