Skip to content

Instantly share code, notes, and snippets.

@BelooS
Created October 30, 2020 16:37
Show Gist options
  • Save BelooS/faca0dba492cc7c512c3c2f08dbceb66 to your computer and use it in GitHub Desktop.
Save BelooS/faca0dba492cc7c512c3c2f08dbceb66 to your computer and use it in GitHub Desktop.
Check branch name
BRANCH_NAME="$1"
PATTERN="^feature\/[A-Z]{2,4}\-[0-9]{1,5}\-.*|^bugfix\/[A-Z]{2,4}\-[0-9]{1,5}\-.*|^release\/.*-v[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$|^junk\/.*|^revert.*|^master$"
if ! [[ $BRANCH_NAME =~ $PATTERN ]]; then
echo "Invalid branch name $BRANCH_NAME"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment