fix: Fix pre-push-hook.sh to prevent fork users from syncing upstream… (#448)
This commit is contained in:
parent
4b03f8de78
commit
446012dfd6
|
|
@ -25,13 +25,20 @@ CURRENT_USER=$(git config user.email)
|
||||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
CURRENT_ORIGIN_BRANCH=$(git rev-parse --abbrev-ref @{u})
|
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
|
# if [[ -n "$CURRENT_ORIGIN_BRANCH" ]]; then
|
||||||
# block_unresolved_conflict "$CURRENT_BRANCH..$CURRENT_ORIGIN_BRANCH"
|
# block_unresolved_conflict "$CURRENT_BRANCH..$CURRENT_ORIGIN_BRANCH"
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
if [ "$CURRENT_BRANCH" = "main" ] && [ "$CURRENT_USER" != "ci_flow@bytedance.com" ]; then
|
# Check if current origin contains coze-dev/coze-studio
|
||||||
echo "${RED}Do not push to main branch manually!!!${NC}"
|
if [[ "$CURRENT_ORIGIN_URL" == *"coze-dev/coze-studio"* ]]; then
|
||||||
exit 1
|
# 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
|
fi
|
||||||
|
|
||||||
if git status --porcelain | grep -q "pnpm-lock.yaml"; then
|
if git status --porcelain | grep -q "pnpm-lock.yaml"; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue