Last active
August 2, 2018 14:09
-
-
Save PurpleBooth/682daa8f5df10a120a027e6a19942344 to your computer and use it in GitHub Desktop.
Ensure that your pivotal tracker story ID is in your commit message using a git commit-msg hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Put this in ".git/hooks/commit-msg" | |
# and make it executable | |
# chmod a+x ".git/hooks/commit-msg" | |
set -euo pipefail | |
MSG="$1" | |
if ! grep -qE '\[(([Dd]elivers|[Ff]ixes|[Ff]inishes) #[0-9]+|(#[0-9]+))([ ,]#[0-9]+)?\]' "$MSG";then | |
cat "$MSG" | |
cat << EOF | |
Your commit message must contain the a pivotal tracker story id in the format [#4576346] somewhere in the message" | |
Examples: | |
[Delivers #12345678] | |
[fixes #12345678] | |
[finishes #12345678] | |
[#12345884 #12345678] | |
[#12345884,#12345678] | |
[#12345678],[#12345884] | |
This will address [#12345884] | |
EOF | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment