Created
December 3, 2015 12:27
-
-
Save kyhule/df0cabd29df5a3f9062a to your computer and use it in GitHub Desktop.
Git hook for verify Jira ticket in commit message
This file contains hidden or 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 | |
# set this to your active development branch | |
current_branch="$(git rev-parse --abbrev-ref HEAD)" | |
# regex to validate in commit msg | |
commit_regex='(DEMO-\d+|merge)' | |
error_msg="Aborting commit. Your commit message is missing either a JIRA Issue ('DEMO-1111') or 'Merge'" | |
if ! grep -iqE "$commit_regex" "$1"; then | |
echo "$error_msg" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment