Last active
June 3, 2019 23:56
-
-
Save brgmnn/bbdcab298ffdfb675f091c73c37dc6de to your computer and use it in GitHub Desktop.
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/sh | |
# Project identifier. This will be either the child technical task identifier or for new tickets | |
# the project code. | |
PROJECT=PROJ | |
case "$2" in | |
merge);; | |
squash);; | |
template);; | |
commit);; | |
*) | |
branch=$(git symbolic-ref HEAD) | |
ticket=$(echo "$branch" | egrep -o "$PROJECT-[0-9]*") | |
if [ $? -eq 0 ]; then | |
printf "\n\nTicket: $ticket\nLink: https://example.com/browse/$ticket\n" \ | |
| cat - $1 > "$1.tmp" && mv "$1.tmp" $1 | |
fi;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment