Last active
May 28, 2020 20:42
-
-
Save StephenVinouze/03327d4b28b17b4eabe902dc3507dc2a 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 | |
MESSAGE=$(cat $1) | |
TICKET=$(git rev-parse --abbrev-ref HEAD | grep -Eo '(\w+[-])?[0-9]+' | tr "[:lower:]" "[:upper:]") | |
if [[ "$MESSAGE" == *"$TICKET"* ]]; then | |
echo "Ticket found in commit message. Skipping..." | |
exit 0 | |
fi | |
echo "[$TICKET] $MESSAGE" > $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment