Skip to content

Commit 6a8c737

Browse files
fix: sync to Gitee when workflow is triggered by tag push
Fetch origin master before pushing branch ref on tag events to avoid detached HEAD refspec errors. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent fa24402 commit 6a8c737

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/sync-gitee.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ jobs:
3030
- name: Push to Gitee
3131
run: |
3232
git remote add gitee git@gitee.com:zhang-yunrui/codesign-vault.git
33+
34+
# Tag push checks out detached HEAD; fetch master before pushing branch ref.
35+
if [ "${{ github.ref_type }}" = "tag" ]; then
36+
git fetch origin master:refs/heads/master
37+
fi
38+
3339
git push gitee refs/heads/master:refs/heads/master
3440
git push gitee --tags

docs/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ ssh-keygen -t ed25519 -C "github-actions-gitee-sync" -f gitee_sync_key -N ""
169169
git push origin master # → 触发 sync-gitee,同步 master 到 Gitee
170170
git tag v1.7.0 && git push origin v1.7.0
171171
# → 触发 release.yml(GitHub + Gitee Release)
172-
# → 触发 sync-gitee.yml(同步 tag
172+
# → 触发 sync-gitee.yml(fetch master 后同步分支与 tags
173173
```
174174

175175
### 本地手动推送到 Gitee(可选)

0 commit comments

Comments
 (0)