[Bug]: CI 对 fork 的 pull_request 事件报 workflow file issue,但 push 到 main 正常
Author: cococoaaCreated Sep 9, 2026Updated Sep 9, 2026
问题描述
从 fork 仓库向本仓库提交 PR 时,触发的 CI(.github/workflows/ci.yaml)在 pull_request 事件下报 "This run likely failed because of a workflow file issue",jobs 为空(没有任何 job 被调度)。 但同一个 workflow 文件在 push 到 main 分支时却能正常通过。
现象(近期 CI 运行记录)
| 事件 | 分支 | 结果 |
|---|---|---|
| push | main(Merge pull request #2253) | success |
| pull_request | fix/autocode-clearcatch-generateserver(#2253) | failure |
| push | main(Merge pull request #2250) | success |
| pull_request | fix/casbin-cache-expire-time(#2250) | failure |
| push | main(feat: 添加授权版…) | success |
| pull_request | bugfix/quote-generated-sql-columns… | action_required |
规律:所有 fork PR 的 pull_request CI 都失败/挂起,所有 push 到 main 的 CI 都成功。 ci.yaml 最后一次修改是 2026-07-14(commit 005a7b74),此后未变。
复现步骤
- fork 本仓库;
- 基于 main 建一个分支,只改任意一个前端文件(例如 .vue);
- 提交 PR;
- 观察 CI:pull_request 事件报 workflow file issue,jobs 为空;
- 该 PR 被合并后,push 事件的 CI 反而正常通过。
根因分析(供参考)
本地用 PyYAML 与 actionlint v1.7.12 校验 ci.yaml 均无语法错误,因此怀疑是 GitHub Actions 针对 fork PR 的 pull_request 事件的运行时校验差异。最可疑的是 ci.yaml 第 189 行:
devops-prod:
if: needs.release-please.outputs.release_created || github.event_name == 'release'在 job 级 if 里引用了 needs.release-please,而 release-please 这个 job 在 pull_request 事件下 会被其自身的 if 条件(github.ref == 'refs/heads/main' || github.event_name == 'release')跳过。 这种「引用一个在 pull_request 下必然被跳过的 job 的 output」的写法,可能触发了校验拒绝。
期望结果
fork PR 的 CI 能正常触发并运行(或明确跳过),而不是整个 workflow 因文件校验失败而挂掉。
Source: flipped-aurora/gin-vue-admin