Skip to content

Instantly share code, notes, and snippets.

@StephenVinouze
Last active May 28, 2020 20:42
Show Gist options
  • Save StephenVinouze/03327d4b28b17b4eabe902dc3507dc2a to your computer and use it in GitHub Desktop.
Save StephenVinouze/03327d4b28b17b4eabe902dc3507dc2a to your computer and use it in GitHub Desktop.
#!/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