Created
October 5, 2022 18:27
-
-
Save choubari/c89b685c334939d581489c537b5bda2f to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Get the commit message from file, which just contains the message | |
commitMessage=$(cat $1) | |
# Ensure each commit message is formatted with a project key (eg: JIRA-1234) | |
pattern="([A-z]{1,5}-[0-9]{1,})+" | |
if [[ ! "$commitMessage" =~ $pattern ]]; then | |
echo "Please add an issue number to the commit message: $commitMessage" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment