diff --git a/frontend/scripts/pre-push-hook.sh b/frontend/scripts/pre-push-hook.sh index a6d564d8..e5917d61 100644 --- a/frontend/scripts/pre-push-hook.sh +++ b/frontend/scripts/pre-push-hook.sh @@ -25,13 +25,20 @@ CURRENT_USER=$(git config user.email) CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) CURRENT_ORIGIN_BRANCH=$(git rev-parse --abbrev-ref @{u}) +# Get current origin URL +CURRENT_ORIGIN_URL=$(git remote get-url origin) + # if [[ -n "$CURRENT_ORIGIN_BRANCH" ]]; then # block_unresolved_conflict "$CURRENT_BRANCH..$CURRENT_ORIGIN_BRANCH" # fi -if [ "$CURRENT_BRANCH" = "main" ] && [ "$CURRENT_USER" != "ci_flow@bytedance.com" ]; then - echo "${RED}Do not push to main branch manually!!!${NC}" - exit 1 +# Check if current origin contains coze-dev/coze-studio +if [[ "$CURRENT_ORIGIN_URL" == *"coze-dev/coze-studio"* ]]; then + # Block push to main branch for coze-dev/coze-studio repository + if [ "$CURRENT_BRANCH" = "main" ] && [ "$CURRENT_USER" != "ci_flow@bytedance.com" ]; then + echo "${RED}Do not push to main branch manually!!!${NC}" + exit 1 + fi fi if git status --porcelain | grep -q "pnpm-lock.yaml"; then