Repository navigation
fix(ci): 只在 PR 与 main 上运行矩阵,避免重复触发导致 macOS job 排队被取消 - #45
Merged
Merged
Conversation
A feature-branch push and the PR opened from the same commit ran the 11-job matrix twice; combined with the merge push this queued nine macOS jobs inside a minute and two queued jobs per push run were cancelled for lack of a runner (runner_id 0, zero steps), marking otherwise-green runs as failure. PR events still validate the branch and a push to main still validates the merged result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复 CI 偶发失败(macOS job 排队被取消)
现象:2026-11-30 的每日扫描中,分支 push(
46456160907)与 main push(46456304324)两个 CI run 标为 failure,但同一 commit 的pull_requestrun(46456252462)全绿。根因:不是代码错误。失败 run 里被取消的两个 job(
Test (macos-latest, Python 3.13)、npm shell (macos-latest, Node 22))runner_id: 0、steps为空、无日志——从未分配到 runner,排队 16-20 分钟后被系统取消,jobcancelled使整个 run 判为 failure。on.push没有分支限制,扫描流程在 45 秒内连续产生「功能分支 push → PR → 合并后 main push」三次 CI run,每次 3 个 macOS job,共 9 个并发 macOS job 挤占账户并发额度。已用
gh run rerun --failed复验:main push run 的第 2 次 attempt 在 52 秒内 11/11 job 全绿,确认为瞬时 runner 容量问题。改动:
on.push增加branches: [main]。功能分支的 push 不再触发整套矩阵,pull_request仍完整验证分支,合并后的 main push 仍验证最终状态。同一 commit 的 CI 从 2 次降为 1 次,三连跑降为 2 次且互不重叠,消除 macOS 排队拥堵。concurrency、timeout-minutes、矩阵覆盖(3 OS × 2 Python、4 个 npm job)均不变,测试强度不降低。验证:YAML 解析通过;本 PR 的
pull_request事件应当只产生 1 个 CI run(无功能分支 push run),合并后的 main push 再产生 1 个,两者均需全绿。