loop-on-ci
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLoop on CI
循环处理CI
Trigger
触发条件
Need to watch a branch or pull request and iterate on CI failures until all required checks are green.
Use as the source of truth. It includes all PR-attached checks, while only covers GitHub Actions.
gh pr checksgh run list需要监控分支或拉取请求(PR),反复处理CI失败项,直至所有必要检查全部通过。
以作为权威数据源。它包含所有与PR关联的检查,而仅覆盖GitHub Actions。
gh pr checksgh run listWorkflow
工作流程
- Resolve the PR for the current branch.
- Inspect current PR checks before waiting.
- If checks already failed, diagnose those failures first.
- If checks are pending, watch with .
gh pr checks --watch --fail-fast - After each push, re-check the full PR check set and repeat until green.
- 解析当前分支对应的PR。
- 在等待前先检查当前PR的检查状态。
- 如果检查已失败,先诊断这些失败原因。
- 如果检查处于待处理状态,使用进行监控。
gh pr checks --watch --fail-fast - 每次推送后,重新检查完整的PR检查集,重复操作直至全部通过。
Commands
命令
bash
undefinedbash
undefinedResolve the active PR
解析当前活跃的PR
gh pr view --json number,url,headRefName
gh pr view --json number,url,headRefName
Inspect all attached checks
检查所有关联的检查项
gh pr checks --json name,bucket,state,workflow,link
gh pr checks --json name,bucket,state,workflow,link
Watch pending checks and fail fast
监控待处理检查项并快速失败
gh pr checks --watch --fail-fast
gh pr checks --watch --fail-fast
GitHub Actions logs, when the failing check links to a GHA run
GitHub Actions日志,当失败检查项链接到GHA运行时使用
gh run view <run-id> --log-failed
undefinedgh run view <run-id> --log-failed
undefinedGuardrails
防护措施
- Keep each fix scoped to a single failure cause when possible.
- Do not bypass hooks () to force progress.
--no-verify - If the failure is clearly unrelated to the PR and appears fixed on main, merge latest main instead of bloating the PR with unrelated fixes.
- If failures are flaky, retry once and report flake evidence.
- Re-run after every push; the check set can change.
gh pr checks --json name,bucket,state,workflow,link
- 尽可能将每个修复限定为单一失败原因。
- 不要绕过钩子()来强行推进。
--no-verify - 如果失败明显与PR无关且在主分支上已修复,合并最新的主分支即可,不要在PR中添加无关修复内容。
- 如果失败是偶发的,重试一次并报告偶发故障的证据。
- 每次推送后重新运行;检查集可能会发生变化。
gh pr checks --json name,bucket,state,workflow,link
Output
输出
- Current CI status
- Failure summary and fixes applied
- PR URL once checks are green
- 当前CI状态
- 失败总结及已应用的修复
- 检查全部通过后的PR URL