Skip to content

ci(dependabot): 显式入队 merge queue,修 dependabot PR 永不自动合入 - #202

Merged
wangzhizhou merged 1 commit into
mainfrom
ci/dependabot-enqueue
Nov 22, 2026
Merged

wangzhizhou merged 1 commit into
mainfrom
ci/dependabot-enqueue

Conversation

@wangzhizhou

Copy link
Copy Markdown
Contributor

问题

main 的 ruleset 启用了 merge queue(SQUASH),而 Dependabot auto-merge 工作流只调 gh pr merge --auto --squash。在这种分支上,--auto 只写下 autoMergeRequest,不会把 PR 放进队列 —— 表现为:检查全绿、mergeStateStatus=CLEAN,但 PR 永远停在 OPEN。

2026-11-22 实测:

PR 起始状态 结果
#195 11-16 起带 auto-merge(method MERGE),15:06 检查全绿 挂着不动,人工 enqueuePullRequest 后 15:38 合入
#199 检查全绿、CLEAN 同上下场

也就是说这条自动化在启用 merge queue 之后完全失效了,dependabot PR 只能靠人手动入队 —— 这也是 11-16 ~ 11-22 期间 4 个依赖 PR 堆积的原因之一。

改动

  • 第 1 步保留 gh pr merge --auto --squash,作为“意图标记”(并兼容将来若关闭队列);加 || true,因为重试/复用分支场景下若已存在其它 merge method 的 autoMergeRequest,gh 会报错,而这不该中断后续入队。
  • 新增第 2 步 Enqueue into the merge queue:GraphQL enqueuePullRequest 显式入队;失败只出 ::warning::(已在队列中 / 必需检查未通过 / 有冲突都属无害情形),并把 gh api 的原始错误写进 job summary,便于定位。
  • patch/minor 才入队,major 仍走人工评审,原有门禁语义不变。

入队后由 merge queue 自己构建 merge group 跑全量 CI,通过才落库 —— 等价于 auto-merge 的效果,且不会因为「等待自动入队」而空转。

验证

  • bash scripts/test-actions-pinning.sh 通过(action 仍固定 40 位 SHA);
  • workflow YAML 可正常解析,三个 step 顺序正确;
  • enqueuePullRequest mutation 已用真实 PR 校验:成功时返回 mergeQueueEntry{position,state},失败时 gh 退出码为 1 且错误可读(本 PR 里正是靠这一点区分成功/告警两条分支)。

另:dependabot 每个 cargo PR 都在报 The following labels could not be found: rust,已直接在仓库设置里补建 rust 标签(.github/dependabot.yml 无需改动)。

`main` 的 ruleset 启用了 merge queue(SQUASH),`gh pr merge --auto` 在这种分支上只写
autoMergeRequest、不会把 PR 放进队列。实测 #195 自 11-16 起带着 auto-merge、检查全绿却
一直停在 OPEN,#199 同样卡在 CLEAN,两个都是人工 `enqueuePullRequest` 才合上的。

- 第 1 步保留 `gh pr merge --auto --squash` 作为意图标记(`|| true`:重试场景下若已有
  其它 merge method 的 autoMergeRequest,gh 会报错,但不应中断);
- 第 2 步用 GraphQL `enqueuePullRequest` 显式入队,失败只出 `::warning::` 并把原因写进
  job summary(已在队列中 / 必需检查未通过 / 有冲突都是无害情形)。

patch/minor 才入队,major 仍走人工评审,门禁语义不变;入队后由 merge queue 自己构建
merge group 跑全量 CI,通过才落库。
@github-actions github-actions Bot added the ci label Nov 22, 2026
@wangzhizhou
wangzhizhou added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 858464f Nov 22, 2026
19 checks passed
@wangzhizhou
wangzhizhou deleted the ci/dependabot-enqueue branch November 22, 2026 16:28
wangzhizhou added a commit that referenced this pull request Nov 22, 2026
Unreleased 补两条此前漏记的变更:
- dependabot PR 显式入队 merge queue(#202),并补建缺失的 `rust` 标签;
- macOS 公证 / Windows Authenticode 签名已抽成可复用 composite action。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant