-
-
Save KyMidd/a819e6c6b6e7630ed510bb075b463bcf 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
| # Filter commit message to just ticket at beginning | |
| unset TICKET_TO_CHECK | |
| TICKET_TO_CHECK=$(git log --max-count=1 --format=%B $commit | tr '[a-z]' '[A-Z]' | sed -nE 's/^([a-zA-Z]{2,}-[0-9]{2,}).*$/\1/p' | head -n 1) | |
| # If line count is zero, couldn't find valid ticket number to check | |
| if [[ $(echo "$TICKET_TO_CHECK" | awk 'NF' | wc -l) -eq 0 ]]; then | |
| echo "************" | |
| echo "❌ Couldn't identify valid ticket number to check in commit" | |
| echo "❌ Invalid commit message: \"$(git log --max-count=1 --format=%B $commit)\"" | |
| invalidTicket=true | |
| else | |
| # If valid ticket number found, check it | |
| echo "************" | |
| echo "Checking if this ticket exists: $TICKET_TO_CHECK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment