Merge pull request #27028 from woocommerce/fix/master-branch-protection-update

Removed wildcards from branch name match.
This commit is contained in:
Claudio Sanches 2020-07-14 13:37:39 -03:00 committed by GitHub
commit 6291315429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -4,7 +4,12 @@ PROTECTED_BRANCH="master"
REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3)
if [ -n "$REMOTE_REF" ]; then
if [ -z "${REMOTE_REF##*$PROTECTED_BRANCH*}" ]; then
if [ "refs/heads/${PROTECTED_BRANCH}" == "$REMOTE_REF" ]; then
if [ "$TERM" == "dumb" ]; then
>&2 echo "Sorry, you are unable to push to master using a GUI client! Please use git CLI."
exit 1
fi
printf "%sYou're about to push to master, is that what you intended? [y/N]: %s" "$(tput setaf 3)" "$(tput sgr0)"
read -r PROCEED < /dev/tty
echo