From 446012dfd6e7754d4375cc4d6508b4d7306e7993 Mon Sep 17 00:00:00 2001 From: wuxingzhong <330332812@qq.com> Date: Sat, 2 Aug 2025 11:58:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Fix=20pre-push-hook.sh=20to=20prevent=20?= =?UTF-8?q?fork=20users=20from=20syncing=20upstream=E2=80=A6=20(#448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/scripts/pre-push-hook.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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