fix: Fix pre-push-hook.sh to prevent fork users from syncing upstream… (#448)

main
wuxingzhong 3 months ago committed by GitHub
parent 4b03f8de78
commit 446012dfd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      frontend/scripts/pre-push-hook.sh

@ -25,14 +25,21 @@ 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
# 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
echo -e "${RED}Error: pnpm-lock.yaml is included in the changes. Please commit it before push!${NC}"

Loading…
Cancel
Save