git-ci
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCI/CD Status Queries
CI/CD状态查询
Query CI/CD pipelines and check merge readiness across GitHub Actions and GitLab CI. All recipes use minimal field sets for token efficiency. Covers pipeline status, failing jobs, run logs, workflow management, and merge readiness assessment.
跨GitHub Actions和GitLab CI查询CI/CD流水线并检查合并就绪状态。 所有方案均使用最小字段集以提升令牌效率。涵盖流水线状态、失败任务、运行日志、工作流管理以及合并就绪状态评估。
When to Use
适用场景
- Checking CI status -- "are checks passing?", "what's failing?", pipeline status
- Watching CI runs -- wait for completion, fail-fast on errors
- Debugging failures -- view logs for failing jobs, identify flaky tests
- Assessing merge readiness -- all checks green, reviews approved, no conflicts
- Listing workflow runs -- recent pipelines, specific workflow history
- Configuring CI allowlists -- auto-approval patterns for read-only CI commands
- 检查CI状态 -- "检查是否通过?"、"哪些环节失败?"、流水线状态
- 监控CI运行 -- 等待完成、出错时快速终止
- 调试失败问题 -- 查看失败任务的日志、识别不稳定测试
- 评估合并就绪状态 -- 所有检查通过、审核已批准、无冲突
- 列出工作流运行记录 -- 近期流水线、特定工作流历史
- 配置CI允许列表 -- 只读CI命令的自动审批模式
Critical Rules
关键规则
- Use (not
gh pr checks) for current-branch CI status. Thegh runsubcommand maps directly to the PR's required status checks.pr checks - Use for current-branch CI in GitLab. It shows the pipeline for the current branch without needing a pipeline ID.
glab ci status - Always use with
--jsonto filter output fields. Full JSON output wastes tokens.gh - Use commands exactly as shown in this skill. The commands below are designed to match auto-approval allowlist patterns. Improvising flags may trigger permission prompts.
- 使用(而非
gh pr checks)查询当前分支的CI状态。gh run子命令直接对应PR的必填状态检查项。pr checks - 在GitLab中使用查询当前分支的CI状态。 无需流水线ID即可显示当前分支的流水线信息。
glab ci status - 使用命令时始终添加
gh参数过滤输出字段。 完整JSON输出会浪费令牌。--json - 严格按照本技能中展示的命令使用。 以下命令专为匹配自动审批允许列表模式设计。随意修改参数可能触发权限提示。
Provider Detection
服务商检测
bash
git remote get-url origin| Remote URL contains | Provider | CLI | CI system |
|---|---|---|---|
| GitHub | | GitHub Actions |
| GitLab | | GitLab CI |
If ambiguous or both present, ask the user.
bash
git remote get-url origin| 远程URL包含内容 | 服务商 | CLI工具 | CI系统 |
|---|---|---|---|
| GitHub | | GitHub Actions |
| GitLab | | GitLab CI |
若存在歧义或同时包含两者,请询问用户。
CI Status (Current Branch)
CI状态(当前分支)
GitHub:
bash
gh pr checks --json name,state,conclusion,bucketGitLab:
bash
glab ci statusGitHub:
bash
gh pr checks --json name,state,conclusion,bucketGitLab:
bash
glab ci statusCI Status as JSON
CI状态(JSON格式)
GitHub:
bash
gh pr checks --json name,state,conclusion,bucketGitLab:
bash
glab ci getGitHub:
bash
gh pr checks --json name,state,conclusion,bucketGitLab:
bash
glab ci getWatch Until Complete
等待运行完成
GitHub:
bash
gh pr checks --watch --fail-fastGitLab:
bash
glab ci status --liveGitHub:
bash
gh pr checks --watch --fail-fastGitLab:
bash
glab ci status --liveRecent Pipeline/Workflow Runs
近期流水线/工作流运行记录
GitHub:
bash
gh run list --json databaseId,displayTitle,status,conclusion,headBranch,event --limit 10GitLab:
bash
glab ci listGitHub:
bash
gh run list --json databaseId,displayTitle,status,conclusion,headBranch,event --limit 10GitLab:
bash
glab ci listSpecific Run Details
特定运行详情
GitHub:
bash
gh run view {run_id} --json jobs,status,conclusion,displayTitleGitLab:
bash
glab ci view {pipeline_id}GitHub:
bash
gh run view {run_id} --json jobs,status,conclusion,displayTitleGitLab:
bash
glab ci view {pipeline_id}Run Logs
运行日志
GitHub:
bash
gh run view {run_id} --log-failedGitLab:
bash
glab ci trace {job_id}GitHub:
bash
gh run view {run_id} --log-failedGitLab:
bash
glab ci trace {job_id}Merge Readiness (Current Branch)
合并就绪状态(当前分支)
GitHub:
bash
gh pr view --json mergeable,reviewDecision,statusCheckRollup,isDraft,mergeStateStatusFields:
- --
mergeable,MERGEABLE, orCONFLICTINGUNKNOWN - --
reviewDecision,APPROVED,CHANGES_REQUESTED, or emptyREVIEW_REQUIRED - -- boolean
isDraft - --
mergeStateStatus,CLEAN,BLOCKED,BEHIND,DIRTYUNSTABLE
GitLab:
bash
glab mr view -F json | jq '{merge_status:.merge_status,conflicts:.has_conflicts,blocking:.blocking_discussions_resolved,draft:.draft}'GitHub:
bash
gh pr view --json mergeable,reviewDecision,statusCheckRollup,isDraft,mergeStateStatus字段说明:
- --
mergeable、MERGEABLE或CONFLICTINGUNKNOWN - --
reviewDecision、APPROVED、CHANGES_REQUESTED或空值REVIEW_REQUIRED - -- 布尔值
isDraft - --
mergeStateStatus、CLEAN、BLOCKED、BEHIND、DIRTYUNSTABLE
GitLab:
bash
glab mr view -F json | jq '{merge_status:.merge_status,conflicts:.has_conflicts,blocking:.blocking_discussions_resolved,draft:.draft}'Variables and Secrets
变量与密钥
GitHub:
bash
gh variable list
gh secret listGitLab:
bash
glab variable listGitHub:
bash
gh variable list
gh secret listGitLab:
bash
glab variable listCI Queries Reference
CI查询参考
Reference: Seefor advanced patterns: failing check extraction, required checks, workflow listing, cache management, rulesets.references/ci-queries.md
参考:查看获取高级模式:失败检查提取、必填检查项、工作流列表、缓存管理、规则集。references/ci-queries.md
Allowlist
允许列表
Reference: Seefor tieredreferences/allowlist.mdpatterns covering all read-only CI operations -- safe to auto-approve in Claude CodeBash(command:*)or OpenCode config.settings.json
参考:查看获取分层references/allowlist.md模式,涵盖所有只读CI操作——可安全在Claude CodeBash(command:*)或OpenCode配置中自动审批。settings.json