From fe3b93f7b3a67cc9b57ef63a902ecf9774c76609 Mon Sep 17 00:00:00 2001 From: zy Date: Sat, 20 Sep 2025 00:37:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20GitHub=20Actions=20?= =?UTF-8?q?release=20workflow=20=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98=20(#1?= =?UTF-8?q?19)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将触发事件从 pull_request 改为 push,解决来自 fork 的 PR 合并时 因权限受限导致的 403 错误。 - 触发条件:从 pull_request(closed) 改为 push to main - 条件判断:相应调整为 push 事件的判断逻辑 这样可以确保 workflow 在代码真正合并到 main 分支后才运行, 此时有完整的 contents:write 权限来创建 release。 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude --- .github/workflows/release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc7db9c..039715d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: Build and Release on: - pull_request: - types: [closed] + push: branches: [ main ] workflow_dispatch: @@ -12,8 +11,8 @@ permissions: jobs: build: runs-on: ubuntu-latest - # 只在 PR 被合并时运行,或手动触发 - if: (github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch') + # 只在推送到 main 时运行,或手动触发 + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch') steps: - uses: actions/checkout@v4