Skip to content

Commit 5a4c602

Browse files
committed
Fix GitLab sync workflow push command
1 parent e1e9d82 commit 5a4c602

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/sync-to-gitlab.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,17 @@ jobs:
2525
GITLAB_REPO: ${{ secrets.GITLAB_REPO }}
2626
run: |
2727
git remote remove gitlab 2>/dev/null || true
28-
git remote add gitlab "${GITLAB_REPO}"
29-
git push --mirror "https://oauth2:${GITLAB_TOKEN}@${GITLAB_REPO#https://}"
28+
29+
# GitLab縺ョ隱崎ィシURL繧剃ス懈・
30+
AUTH_URL="https://oauth2:${GITLAB_TOKEN}@${GITLAB_REPO#https://}"
31+
32+
# 蜈ィ縺ヲ縺ョ繝ェ繝「繝シ繝郁ソス霍。繝悶Λ繝ウ繝√r繝ュ繝シ繧ォ繝ォ繝悶Λ繝ウ繝√↓縺吶k・・rigin/xxx -> xxx・・
33+
# 窶サ縺薙l縺ォ繧医jrefs/remotes/origin/* 縺碁€∽ソ。諡貞凄縺輔l繧九お繝ゥ繝シ繧貞屓驕ソ
34+
git branch -r | grep -v '\->' | while read remote; do
35+
branch="${remote#origin/}"
36+
git branch -f "$branch" "$remote" 2>/dev/null || true
37+
done
38+
39+
# 蜈ィ繝悶Λ繝ウ繝√→繧ソ繧ー繧貞シキ蛻カ繝励ャ繧キ繝・
40+
git push --all --force "$AUTH_URL"
41+
git push --tags --force "$AUTH_URL"

0 commit comments

Comments
 (0)