Repository navigation
ci: 依赖合并遇到头提交竞态时跳过,不再染红整轮 - #15
Merged
Merged
Conversation
2026-11-02 的「Dependabot validated merge」在 PR #14 上失败: CalledProcessError: Command '['gh', 'pr', 'merge', '14', '--repo', laincat/AwesomePyKit', '--squash', '--delete-branch', '--match-head-commit', '97638aa...']' returned non-zero exit status 1 脚本先按 sha 校验检查项,再执行带 --match-head-commit 的合并;这中间 Dependabot 又推了新提交(01:16:55 → d00fb66),头提交不再匹配,gh 拒绝 合并,check=True 直接把整轮门禁判红。下一次调度(01:19:27)已经正常合掉 同一个 PR,说明只是竞态。 改动: - gh pr merge 包在 try/except 里:失败时打印 "PR #N: merge skipped: ..." 并 继续下一个 PR,让下一次调度重新校验; - 合并成功后触发 post-merge / release 的 workflow_dispatch 仍然 check=True, 那一步失败是真问题,不能吞; - 补一条回归测试:合并调用抛 CalledProcessError 时不抛异常、也不触发后续 dispatch。 验证:python -m unittest test_dependabot_merge(含新增用例)通过; ruff check 通过。
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
现象
2026-11-02T01:14:51Z 的「Dependabot validated merge」在 PR #14 上失败:
原因
.github/scripts/dependabot_merge.py先按 head sha 校验 check-runs 和 commit status,再用--match-head-commit执行gh pr merge。这中间 Dependabot 又推了新提交(
01:16:55Z→d00fb666),头提交不再匹配,gh直接拒绝,check=True让整轮门禁变红。下一次调度(
01:19:27Z)已经用新 sha 正常合掉了同一个 PR,所以这是纯粹的竞态,不是策略漏洞。改动
gh pr merge包进try/except subprocess.CalledProcessError:失败时打印PR #N: merge skipped: <最后一行 stderr>并continue处理下一个 PR,交给下一次调度重新校验workflow_dispatch(post-merge build、release)保持check=True—— 那一步失败是真问题,不能吞test_merge_race_is_skipped_not_fatal:合并调用抛CalledProcessError时不抛异常、也不再触发后续 dispatch验证
python -m unittest test_dependabot_merge:全部通过(含新增用例)ruff check:通过