一键导入
github
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Word文档处理:创建、编辑、读取.docx文件。用户提到"Word"、"文档"、".docx"、"报告"、"信函"时使用。
使用腾讯云 API 密钥调用腾讯云各种服务,包括翻译、CVM、COS等。
图片识别与图文理解,基于 PaddleOCR-VL 模型,支持识别图片中的文字、场景、物体等信息。支持109种语言,可输出JSON或Markdown格式。
You MUST use this for gathering contexts before any work. This is a Knowledge management for AI agents. Use `brv` to store and retrieve project patterns, decisions, and architectural rules in .brv/context-tree. Uses a configured LLM provider (default: ByteRover, no API key needed) for query and curate operations.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Transform AI agents from task-followers into proactive partners that anticipate needs and continuously improve. Now with WAL Protocol, Working Buffer, Autonomous Crons, and battle-tested patterns. Part of the Hal Stack 🦞
| name | github |
| description | Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries. |
| triggers | ["GitHub","github","代码仓库","开源","pull request","issue","仓库","代码","CI/CD","工作流"] |
使用 gh CLI 与 GitHub 交互。当不在 git 目录中时,始终指定 --repo owner/repo,或直接使用 URL。
# 查看仓库信息
gh repo view owner/repo
# 克隆仓库
gh repo clone owner/repo
# 创建新仓库
gh repo create my-new-repo --public --clone
# 登录 GitHub
gh auth login
# 检查登录状态
gh auth status
# 创建新问题
gh issue create --title "Bug报告" --body "详细描述..." --repo owner/repo
# 列出问题
gh issue list --repo owner/repo --state all
# 查看特定问题
gh issue view 123 --repo owner/repo
# 添加评论
gh issue comment 123 --body "这是修复建议" --repo owner/repo
# 按标签过滤
gh issue list --repo owner/repo --label bug
# 按状态过滤
gh issue list --repo owner/repo --state open
# 按作者过滤
gh issue list --repo owner/repo --author username
# 按分配者过滤
gh issue list --repo owner/repo --assignee username
# 创建 PR
gh pr create --title "新功能" --body "详细说明..." --repo owner/repo
# 查看 PR
gh pr view 55 --repo owner/repo
# 列出 PR
gh pr list --repo owner/repo --state all
# 合并 PR
gh pr merge 55 --repo owner/repo --squash
# 检查 CI 状态
gh pr checks 55 --repo owner/repo
# 添加评论
gh pr comment 55 --body "很好的修改!" --repo owner/repo
# 请求更改
gh pr review 55 --repo owner/repo --request-changes --body "需要修复..."
# 批准 PR
gh pr review 55 --repo owner/repo --approve --body "已批准"
# 列出工作流运行
gh run list --repo owner/repo
# 查看特定运行
gh run view <run-id> --repo owner/repo
# 查看失败运行的日志
gh run view <run-id> --repo owner/repo --log-failed
# 重新运行工作流
gh run rerun <run-id> --repo owner/repo
# 查看最近运行
gh run list --repo owner/repo --limit 10
# 按状态过滤
gh run list --repo owner/repo --status failure
# 按分支过滤
gh run list --repo owner/repo --branch main
# 创建分支
gh repo create-branch new-feature --base main --repo owner/repo
# 切换分支
gh repo checkout feature-branch --repo owner/repo
# 删除分支
gh repo delete-branch old-feature --repo owner/repo
# 创建发布
gh release create v1.0.0 --title "版本1.0.0" --notes "新功能..." --repo owner/repo
# 列出发布
gh release list --repo owner/repo
# 查看发布详情
gh release view v1.0.0 --repo owner/repo
gh api 命令用于访问其他子命令无法获取的数据。
# 获取仓库信息
gh api repos/owner/repo
# 获取 PR 详情
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
# 获取问题详情
gh api repos/owner/repo/issues/123 --jq '.title, .body, .labels[].name'
# 获取所有公开仓库
gh api user/repos --jq '.[] | select(.private == false) | .full_name'
# 获取最近的提交
gh api repos/owner/repo/commits --jq '.[0] | .commit.message, .author.login'
# 统计问题数量
gh api repos/owner/repo/issues --jq 'length'
大多数命令支持 --json 用于结构化输出。可以使用 --jq 进行过滤:
# 列出问题并格式化输出
gh issue list --repo owner/repo --json number,title,state,createdAt --jq '.[] | "\(.number): \(.title) [\(.state)]"'
# 列出 PR 并格式化
gh pr list --repo owner/repo --json number,title,author,state --jq '.[] | "PR #\(.number): \(.title) by \(.author.login)"'
# 获取工作流运行详情
gh run list --repo owner/repo --json databaseId,workflowName,status,conclusion --jq '.[] | "\(.databaseId): \(.workflowName) - \(.status)"'
gh pr list --repo owner/repo --state open --json number,title,createdAt --jq '.[] | "PR #\(.number): \(.title) (创建于: \(.createdAt))"'
# 统计开放问题
gh issue list --repo owner/repo --state open --json number | jq length
# 统计按标签分组的问题
gh issue list --repo owner/repo --state all --json labels | jq -r '.[].labels[].name' | sort | uniq -c
# 创建问题模板
gh issue create --repo owner/repo --title "Bug: $BUG_TITLE" --body-file bug_template.md
# 批量关闭旧问题
gh issue list --repo owner/repo --state open --json number,createdAt --jq '.[] | select(.createdAt < "2024-01-01") | .number' | xargs -I {} gh issue close {} --repo owner/repo
# 设置默认仓库
export GH_REPO=owner/repo
# 设置输出格式
export GH_OUTPUT=json
--repo 参数:当不在 git 目录时,始终指定仓库--json 和 --jq:用于脚本和自动化--web 打开网页:gh pr view 55 --web 在浏览器中打开--limit 100 获取更多结果Q: 如何在没有 git 目录的情况下使用 gh?
A: 始终使用 --repo owner/repo 参数指定仓库。
Q: 如何批量处理问题?
A: 结合 gh issue list --json 和 jq 进行过滤,然后使用 xargs 处理。
Q: 如何查看命令的完整选项?
A: 使用 gh issue --help 查看特定命令的帮助信息。
# 查看帮助
gh help
gh issue --help
gh pr --help
# 查看版本
gh --version
GitHub CLI 文档:https://cli.github.com/manual/ GitHub REST API 文档:https://docs.github.com/en/rest