github

github

热门

用于 issues、PR、CI/检查日志、评论、审查、发布、仓库和 gh API 查询的 GitHub CLI。

38万Star
8.1万Fork
更新于 2026/7/25
SKILL.md
readonly只读
name
github
description

用于 issues、PR、CI/检查日志、评论、审查、发布、仓库和 gh API 查询的 GitHub CLI。

GitHub

使用 gh 操作 GitHub。使用 git 进行本地提交/分支/推送/拉取。使用代码阅读工具进行深度审查。

认证

gh auth status
gh auth login

Gateway HOME 可能与操作员 HOME 不同。如果 gh 认证存在于其他地方,请在 gateway 服务环境中设置 GH_CONFIG_DIR 并重启。

PR

gh pr list --repo owner/repo --json number,title,state,author,url
gh pr view 55 --repo owner/repo --json title,body,author,files,commits,reviews,reviewDecision
gh pr checks 55 --repo owner/repo
gh pr diff 55 --repo owner/repo
gh pr create --repo owner/repo --title "feat: title" --body-file /tmp/pr.md
gh pr merge 55 --repo owner/repo --squash

URL 可直接使用:gh pr view https://github.com/owner/repo/pull/55

Issues

gh issue list --repo owner/repo --state open --json number,title,labels,url
gh issue view 42 --repo owner/repo --json title,body,comments,labels,state
gh issue create --repo owner/repo --title "Bug: ..." --body-file /tmp/issue.md
gh issue comment 42 --repo owner/repo --body-file /tmp/comment.md
gh issue close 42 --repo owner/repo --comment "Fixed in ..."

CI/运行

gh run list --repo owner/repo --limit 10
gh run view <run-id> --repo owner/repo --json status,conclusion,headSha,url
gh run view <run-id> --repo owner/repo --log-failed
gh run rerun <run-id> --repo owner/repo --failed

API

gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
gh api repos/owner/repo/labels --jq '.[].name'
gh api --cache 1h repos/owner/repo --jq '{stars: .stargazers_count, forks: .forks_count}'

使用 --json + --jq 获取结构化输出。对于包含反引号、shell 片段、环境名称或用户文本的评论/正文,请使用 --body-file