mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
test
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# 获取当前分支名
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "post"
|
||||
# 如果是从 feature 分支推送
|
||||
if [[ $BRANCH == feature/* || $BRANCH == fix/* ]]; then
|
||||
# 获取远程仓库列表
|
||||
REMOTES=$(git remote)
|
||||
|
||||
# 检查是否存在 gitlab 和 github 远程仓库
|
||||
if echo "$REMOTES" | grep -q "gitlab"; then
|
||||
echo "Pushing $BRANCH to GitLab..."
|
||||
git push gitlab $BRANCH
|
||||
fi
|
||||
fi
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# 如果是由我们的脚本触发的push,直接返回
|
||||
if [ "$PUSHING_TO_GITHUB" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 获取当前分支名
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
# 如果是从 feature 分支推送
|
||||
if [[ $BRANCH == feature/* || $BRANCH == fix/* ]]; then
|
||||
# 获取远程仓库列表
|
||||
REMOTES=$(git remote)
|
||||
|
||||
# 检查是否存在 gitlab 远程仓库
|
||||
if ! echo "$REMOTES" | grep -q "gitlab"; then
|
||||
echo "Error: GitLab remote repository not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Pushing $BRANCH to GitLab..."
|
||||
|
||||
# 如果存在 github 远程仓库,推送到 GitHub
|
||||
if echo "$REMOTES" | grep -q "github"; then
|
||||
echo "Pushing $BRANCH to GitHub..."
|
||||
PUSHING_TO_GITHUB=1 git push github $BRANCH
|
||||
fi
|
||||
|
||||
exit 0
|
||||
else
|
||||
echo "Error: Can only push feature/* or fix/* branches"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user