
关于
使用 gh CLI 处理 Issue、Pull Request、Actions 运行和 GitHub API 查询。
name: github
description: "使用gh CLI处理issues、pull requests、Actions运行和GitHub API查询。"
risk: safe
source: "Dimillian/Skills (MIT)"
date_added: "2026-03-25"
GitHub 技能
使用gh CLI与GitHub交互。不在git目录中时始终指定--repo owner/repo,或直接使用URL。
何时使用
- 当用户询问GitHub issues、pull requests、工作流运行或CI失败时。
- 当你需要从命令行使用
gh issue、gh pr、gh run或gh api时。
Pull Requests
检查PR的CI状态:
gh pr checks 55 --repo owner/repo
列出最近的工作流运行:
gh run list --repo owner/repo --limit 10
查看运行并查看哪些步骤失败:
gh run view <run-id> --repo owner/repo
仅查看失败步骤的日志:
gh run view <run-id> --repo owner/repo --log-failed
调试CI失败
按以下顺序调查失败的CI运行:
- 检查PR状态 — 确定哪些检查失败:
gh pr checks 55 --repo owner/repo - 列出最近运行 — 找到相关的运行ID:
gh run list --repo owner/repo --limit 10 - 查看失败运行 — 查看哪些作业和步骤失败:
gh run view <run-id> --repo owner/repo - 获取失败日志 — 获取失败步骤的详细输出:
gh run view <run-id> --repo owner/repo --log-failed
高级查询的API
gh api命令适用于访问其他子命令无法获取的数据。
获取带特定字段的PR:
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
JSON输出
大多数命令支持--json获取结构化输出。可以使用--jq进行过滤:
gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'
限制
- 仅在任务明确匹配上述描述范围时使用此技能。
- 不要将输出视为特定环境验证、测试或专家审查的替代品。
- 如果缺少必需的输入、权限、安全边界或成功标准,请停下来要求澄清。
兼容工具
Claude CodeCursor
标签
后端开发
