fix: 修复 GitHub Actions release workflow 权限问题 (#119)
将触发事件从 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 <noreply@anthropic.com>
This commit is contained in:
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user