Created
March 20, 2020 19:43
-
-
Save aneesahammed/9f7a6f0c52c968e01e0054cb322ace92 to your computer and use it in GitHub Desktop.
Git commit-msg hook to validate for rally/agile central user-story/defect reference
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
#!/bin/bash | |
# Aborts commit if commit-message is unsatisfactory. | |
# Standard commit format for CA Agile Central "US12345 your-commit-message.." | |
# regex to validate commit message | |
commit_standard_regex='^(US|DE)[0-9]{5,7} .+$' | |
error_message="Aborting commit. Please ensure your commit message meets the | |
standard requirement. 'UserStoryID# Commit-Message'" | |
if ! grep -iqE "$commit_standard_regex" "$1"; then | |
echo "$error_message" >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment