github

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Skill

GitHub 技能

Use the
gh
CLI to interact with GitHub. Always specify
--repo owner/repo
when not in a git directory, or use URLs directly.
使用
gh
CLI与GitHub进行交互。当不在git目录中时,请务必指定
--repo owner/repo
,或直接使用URL。

Pull Requests

拉取请求(PR)

Check CI status on a PR:
bash
gh pr checks 55 --repo owner/repo
List recent workflow runs:
bash
gh run list --repo owner/repo --limit 10
View a run and see which steps failed:
bash
gh run view <run-id> --repo owner/repo
View logs for failed steps only:
bash
gh run view <run-id> --repo owner/repo --log-failed
查看PR的CI状态:
bash
gh pr checks 55 --repo owner/repo
列出最近的工作流运行记录:
bash
gh run list --repo owner/repo --limit 10
查看某次运行记录并查看哪些步骤失败:
bash
gh run view <run-id> --repo owner/repo
仅查看失败步骤的日志:
bash
gh run view <run-id> --repo owner/repo --log-failed

API for Advanced Queries

用于高级查询的API

The
gh api
command is useful for accessing data not available through other subcommands.
Get PR with specific fields:
bash
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
gh api
命令可用于访问其他子命令无法获取的数据。
获取包含特定字段的PR:
bash
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'

JSON Output

JSON 输出

Most commands support
--json
for structured output. You can use
--jq
to filter:
bash
gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'
大多数命令支持使用
--json
生成结构化输出。你可以使用
--jq
进行过滤:
bash
gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'