mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
fix(workflow): 修复自动标签工作流中的重复标签问题
- 添加了对现有标签的检查以避免重复创建 - 配置了从正确的提交哈希进行检出 - 在推送标签前验证标签是否已存在 - 添加了标签已存在时的优雅退出机制 - 确保了 Git 配置的一致性设置
This commit is contained in:
parent
ef655bbaf1
commit
9b77aa4b07
12
.github/workflows/auto-tag.yml
vendored
12
.github/workflows/auto-tag.yml
vendored
@ -25,8 +25,9 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.workflow_run.head_sha }}
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
- name: Check for skip keyword
|
||||
id: check_skip
|
||||
run: |
|
||||
@ -54,7 +55,14 @@ jobs:
|
||||
PAT: ${{ secrets.PAT_TOKEN }}
|
||||
TAG: ${{ steps.version.outputs.new_tag }}
|
||||
run: |
|
||||
set -e
|
||||
git config user.name "GitHub Action"
|
||||
git config user.email "action@github.com"
|
||||
|
||||
if git show-ref --tags --verify --quiet "refs/tags/$TAG"; then
|
||||
echo "Tag $TAG already exists, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git tag -a "$TAG" -m "Auto tag $TAG"
|
||||
git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG"
|
||||
git push "https://x-access-token:${PAT}@github.com/${{ github.repository }}.git" "$TAG"
|
||||
Loading…
x
Reference in New Issue
Block a user