diff --git a/.husky/post-push b/.husky/pre-push similarity index 68% rename from .husky/post-push rename to .husky/pre-push index a8877f5c054..e52fd7c5635 100755 --- a/.husky/post-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -./bin/post-push.sh +./bin/pre-push.sh diff --git a/bin/post-merge.sh b/bin/post-merge.sh index b7d9ac1bab4..ea9143d568d 100755 --- a/bin/post-merge.sh +++ b/bin/post-merge.sh @@ -9,5 +9,7 @@ runOnChange() { fi } -runOnChange "package-lock.json" "pnpm install" +runOnChange "pnpm-lock.yaml" "pnpm install" runOnChange "composer.lock" "SKIP_UPDATE_TEXTDOMAINS=true composer install" +runOnChange "plugins/woocommerce/composer.lock" "SKIP_UPDATE_TEXTDOMAINS=true composer --working-dir=plugins/woocommerce install" +runOnChange "plugins/woocommerce-beta-tester/composer.lock" "SKIP_UPDATE_TEXTDOMAINS=true composer --working-dir=plugins/woocommerce-beta-tester install" diff --git a/bin/pre-push.sh b/bin/pre-push.sh index 8dc3a6e0f9b..9b2346b136f 100755 --- a/bin/pre-push.sh +++ b/bin/pre-push.sh @@ -1,27 +1,24 @@ #!/bin/sh PROTECTED_BRANCH="trunk" -REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3) - -if [ -n "$REMOTE_REF" ]; then - if [ "refs/heads/${PROTECTED_BRANCH}" = "$REMOTE_REF" ]; then - if [ "$TERM" = "dumb" ]; then - >&2 echo "Sorry, you are unable to push to trunk using a GUI client! Please use git CLI." - exit 1 - fi - - printf "%sYou're about to push to trunk, is that what you intended? [y/N]: %s" "$(tput setaf 3)" "$(tput sgr0)" - read -r PROCEED < /dev/tty - echo - - if [ "$(echo "${PROCEED:-n}" | tr "[:upper:]" "[:lower:]")" = "y" ]; then - echo "$(tput setaf 2)Brace yourself! Pushing to the trunk branch...$(tput sgr0)" - echo - exit 0 - fi - - echo "$(tput setaf 2)Push to trunk cancelled!$(tput sgr0)" - echo +CURRENT_BRANCH=$(git branch --show-current) +if [ $PROTECTED_BRANCH = $CURRENT_BRANCH ]; then + if [ "$TERM" = "dumb" ]; then + >&2 echo "Sorry, you are unable to push to $PROTECTED_BRANCH using a GUI client! Please use git CLI." exit 1 fi + + printf "%sYou're about to push to $PROTECTED_BRANCH, is that what you intended? [y/N]: %s" "$(tput setaf 3)" "$(tput sgr0)" + read -r PROCEED < /dev/tty + echo + + if [ "$(echo "${PROCEED:-n}" | tr "[:upper:]" "[:lower:]")" = "y" ]; then + echo "$(tput setaf 2)Brace yourself! Pushing to the $PROTECTED_BRANCH branch...$(tput sgr0)" + echo + exit 0 + fi + + echo "$(tput setaf 2)Push to $PROTECTED_BRANCH cancelled!$(tput sgr0)" + echo + exit 1 fi