From 45e50774310a1423218666aecc36534a5a1d3ab0 Mon Sep 17 00:00:00 2001 From: George Xu Date: Wed, 9 Nov 2022 12:12:36 -0800 Subject: [PATCH] chore: add husky pre-push script --- .husky/pre-push | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 .husky/pre-push diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000000..b509e4e26e --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,17 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +BRANCH=`git rev-parse --abbrev-ref HEAD` +PROTECTED_BRANCH="gxu-husky" + +exec < /dev/tty + +if [ "$BRANCH" = $PROTECTED_BRANCH ]; then + echo $BRANCH + read -p "[pre-push hook] Warning: this is a protected branch. Continue? (Y/n) " yn + case $yn in + [Yy]* ) exit 0;; + [Nn]* ) exit 1;; + * ) echo "Please answer y or n for yes or no."; exit 1;; + esac +fi