23 支持
3 部分支持
0 不支持
- ·gh CLI 原生支持 --json 输出,适合管道处理
- ·全非交互模式,exit code 规范,CI/脚本场景一流
- ·官方 MCP server(github-mcp-server)完整覆盖 Issue/PR/Actions
- ·官方维护,活跃更新
功能覆盖矩阵
Issue
4/5 支持 支持 创建 Issue
命令
gh issue create --title 'Bug: login fails' --body '## 描述 登录时报 500' --label bug --assignee @me
输入参数
--title: Issue 标题 --body: 描述(支持 Markdown) --label: 标签(可多个) --assignee: 指派人
示例输出
https://github.com/owner/repo/issues/42
支持 查询 Issue 列表
命令
gh issue list --state open --label bug --json number,title,assignees,createdAt
示例输出
[{ "number": 42, "title": "Bug: login fails", "assignees": [...] }] 备注:--json 输出机器可读,适合 agent 处理
支持 关闭 Issue
命令
gh issue close 42 --comment 'Fixed in #45'
示例输出
Issue #42 closed
支持 添加 Issue 评论
命令
gh issue comment 42 --body 'Reproduced on v2.3.1'
示例输出
https://github.com/owner/repo/issues/42#issuecomment-xxx
部分支持 批量关闭 Issue
命令
gh issue list --label stale --json number -q '.[].number' | xargs -I{} gh issue close {} 备注:组合 gh + xargs 可批量操作,但速率受 API 限制
Gap:无原生批量操作命令,需脚本组合
Pull Request
5/5 支持 支持 创建 PR
命令
gh pr create --title 'feat: add GA4 tracking' --body '## 改动 注入 gtag.js' --base main --head feat/ga4
示例输出
https://github.com/owner/repo/pull/55
支持 查看 PR 详情 + diff
命令
gh pr view 55 --json title,body,additions,deletions,files,reviews
示例输出
{ "title": "feat: add GA4 tracking", "additions": 12, "deletions": 1, "files": [...] } 支持 提交 PR Review
命令
gh pr review 55 --approve --body 'LGTM'
示例输出
Approved pull request #55
备注:支持 --approve / --request-changes / --comment 三种 review 类型
支持 合并 PR
命令
gh pr merge 55 --squash --delete-branch
示例输出
Merged pull request #55
支持 查看 CI 检查状态
命令
gh pr checks 55 --json name,state,conclusion
示例输出
[{ "name": "build", "state": "completed", "conclusion": "success" }] GitHub Actions
5/6 支持 支持 查询 Workflow 列表
命令
gh workflow list --json id,name,state
示例输出
[{ "id": 12345, "name": "CI", "state": "active" }] 支持 手动触发 Workflow
命令
gh workflow run ci.yml --ref main --field environment=staging
示例输出
Created workflow_dispatch event for ci.yml
支持 查看运行日志
命令
gh run view 9876543 --log
示例输出
(完整日志文本,适合 agent 做错误摘要)
备注:日志量大时建议加 --log-failed 只看失败步骤
支持 取消正在运行的 Workflow
命令
gh run cancel 9876543
示例输出
✓ Requested cancellation of run 9876543
支持 重跑失败的 Job
命令
gh run rerun 9876543 --failed
示例输出
✓ Requested rerun of failed jobs for run 9876543
部分支持 管理 Actions Secrets
命令
gh secret set MY_TOKEN --body 'xxx'
备注:可以设置/删除 Secret,但无法读取 Secret 值(安全限制)
Gap:Secret 值读取不开放,符合安全设计
Releases
4/4 支持 支持 创建 Release
命令
gh release create v1.2.0 --title 'v1.2.0' --notes '## 新功能 - App 覆盖矩阵' dist/*.tar.gz
输入参数
tag: 版本号(如 v1.2.0) --notes: Release 说明(Markdown) files: 附件(可选)
示例输出
https://github.com/owner/repo/releases/tag/v1.2.0
支持 查询 Release 列表
命令
gh release list --json tagName,publishedAt,isLatest
示例输出
[{ "tagName": "v1.2.0", "isLatest": true }] 支持 下载 Release 附件
命令
gh release download v1.2.0 --pattern '*.tar.gz' --dir ./downloads
示例输出
Downloaded dist-v1.2.0.tar.gz to ./downloads
支持 删除 Release
命令
gh release delete v1.2.0 --yes
示例输出
✓ Deleted release v1.2.0
代码搜索
3/3 支持 支持 全局代码搜索
命令
gh search code 'getStaticPaths' --repo owner/repo --json path,textMatches
示例输出
[{ "path": "src/pages/app/[id].astro", "textMatches": [...] }] 支持 搜索仓库
命令
gh search repos 'mcp server' --language typescript --sort stars --json fullName,stargazersCount
示例输出
[{ "fullName": "modelcontextprotocol/servers", "stargazersCount": 8200 }] 支持 搜索 Commit
命令
gh search commits 'fix: auth bug' --repo owner/repo --json sha,message,author
示例输出
[{ "sha": "abc123", "message": "fix: auth bug in login flow" }] 通知
2/3 支持 支持 查询未读通知
命令
mcp call notifications.list all=false
示例输出
[{ "id": "xxx", "subject": { "title": "PR #55 merged", "type": "PullRequest" } }] 支持 标记通知为已读
命令
mcp call notifications.mark_read thread_id=xxx
示例输出
{ "status": "ok" } 部分支持 订阅/取消订阅仓库通知
备注:可通过 API 设置 subscription,但 CLI 无直接命令
Gap:gh CLI 未内置 subscription 管理,需用 API 调用
Gap 总结 (3 个功能缺口)
部分
Issue › 批量关闭 Issue
无原生批量操作命令,需脚本组合
部分
GitHub Actions › 管理 Actions Secrets
Secret 值读取不开放,符合安全设计
部分
通知 › 订阅/取消订阅仓库通知
gh CLI 未内置 subscription 管理,需用 API 调用