git-ci

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CI/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

关键规则

  1. Use
    gh pr checks
    (not
    gh run
    ) for current-branch CI status.
    The
    pr checks
    subcommand maps directly to the PR's required status checks.
  2. Use
    glab ci status
    for current-branch CI in GitLab.
    It shows the pipeline for the current branch without needing a pipeline ID.
  3. Always use
    --json
    with
    gh
    to filter output fields.
    Full JSON output wastes tokens.
  4. 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.

  1. 使用
    gh pr checks
    (而非
    gh run
    )查询当前分支的CI状态。
    pr checks
    子命令直接对应PR的必填状态检查项。
  2. 在GitLab中使用
    glab ci status
    查询当前分支的CI状态。
    无需流水线ID即可显示当前分支的流水线信息。
  3. 使用
    gh
    命令时始终添加
    --json
    参数过滤输出字段。
    完整JSON输出会浪费令牌。
  4. 严格按照本技能中展示的命令使用。 以下命令专为匹配自动审批允许列表模式设计。随意修改参数可能触发权限提示。

Provider Detection

服务商检测

bash
git remote get-url origin
Remote URL containsProviderCLICI system
github.com
GitHub
gh
GitHub Actions
gitlab.com
or self-hosted GitLab
GitLab
glab
GitLab CI
If ambiguous or both present, ask the user.

bash
git remote get-url origin
远程URL包含内容服务商CLI工具CI系统
github.com
GitHub
gh
GitHub Actions
gitlab.com
或自托管GitLab
GitLab
glab
GitLab CI
若存在歧义或同时包含两者,请询问用户。

CI Status (Current Branch)

CI状态(当前分支)

GitHub:
bash
gh pr checks --json name,state,conclusion,bucket
GitLab:
bash
glab ci status
GitHub:
bash
gh pr checks --json name,state,conclusion,bucket
GitLab:
bash
glab ci status

CI Status as JSON

CI状态(JSON格式)

GitHub:
bash
gh pr checks --json name,state,conclusion,bucket
GitLab:
bash
glab ci get
GitHub:
bash
gh pr checks --json name,state,conclusion,bucket
GitLab:
bash
glab ci get

Watch Until Complete

等待运行完成

GitHub:
bash
gh pr checks --watch --fail-fast
GitLab:
bash
glab ci status --live
GitHub:
bash
gh pr checks --watch --fail-fast
GitLab:
bash
glab ci status --live

Recent Pipeline/Workflow Runs

近期流水线/工作流运行记录

GitHub:
bash
gh run list --json databaseId,displayTitle,status,conclusion,headBranch,event --limit 10
GitLab:
bash
glab ci list
GitHub:
bash
gh run list --json databaseId,displayTitle,status,conclusion,headBranch,event --limit 10
GitLab:
bash
glab ci list

Specific Run Details

特定运行详情

GitHub:
bash
gh run view {run_id} --json jobs,status,conclusion,displayTitle
GitLab:
bash
glab ci view {pipeline_id}
GitHub:
bash
gh run view {run_id} --json jobs,status,conclusion,displayTitle
GitLab:
bash
glab ci view {pipeline_id}

Run Logs

运行日志

GitHub:
bash
gh run view {run_id} --log-failed
GitLab:
bash
glab ci trace {job_id}

GitHub:
bash
gh run view {run_id} --log-failed
GitLab:
bash
glab ci trace {job_id}

Merge Readiness (Current Branch)

合并就绪状态(当前分支)

GitHub:
bash
gh pr view --json mergeable,reviewDecision,statusCheckRollup,isDraft,mergeStateStatus
Fields:
  • mergeable
    --
    MERGEABLE
    ,
    CONFLICTING
    , or
    UNKNOWN
  • reviewDecision
    --
    APPROVED
    ,
    CHANGES_REQUESTED
    ,
    REVIEW_REQUIRED
    , or empty
  • isDraft
    -- boolean
  • mergeStateStatus
    --
    CLEAN
    ,
    BLOCKED
    ,
    BEHIND
    ,
    DIRTY
    ,
    UNSTABLE
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
    CONFLICTING
    UNKNOWN
  • reviewDecision
    --
    APPROVED
    CHANGES_REQUESTED
    REVIEW_REQUIRED
    或空值
  • isDraft
    -- 布尔值
  • mergeStateStatus
    --
    CLEAN
    BLOCKED
    BEHIND
    DIRTY
    UNSTABLE
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 list
GitLab:
bash
glab variable list

GitHub:
bash
gh variable list
gh secret list
GitLab:
bash
glab variable list

CI Queries Reference

CI查询参考

Reference: See
references/ci-queries.md
for advanced patterns: failing check extraction, required checks, workflow listing, cache management, rulesets.

参考:查看
references/ci-queries.md
获取高级模式:失败检查提取、必填检查项、工作流列表、缓存管理、规则集。

Allowlist

允许列表

Reference: See
references/allowlist.md
for tiered
Bash(command:*)
patterns covering all read-only CI operations -- safe to auto-approve in Claude Code
settings.json
or OpenCode config.
参考:查看
references/allowlist.md
获取分层
Bash(command:*)
模式,涵盖所有只读CI操作——可安全在Claude Code
settings.json
或OpenCode配置中自动审批。