GitHub CLI for issues, PRs, CI/check logs, comments, reviews, releases, repos, and gh api queries.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-github-92048ebea0be ,按照其中的说明把「github」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Use gh for GitHub. Use git for local commits/branches/push/pull. Use code-reading tools for deep reviews.
gh auth status
gh auth login
Gateway HOME can differ from operator HOME. If gh auth exists elsewhere, set GH_CONFIG_DIR in the gateway service env and restart.
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
When creating or refreshing a PR body, append this final footer only when the Runtime line supplies sessionUrl=<exact-url>. Replace <sessionUrl> with that URL verbatim; do not construct or modify it. Omit the footer when sessionUrl is absent. Preserve any publication marker before exactly one footer, and keep the footer final:
---
[View the OpenClaw team session](<sessionUrl>)
URLs work directly: gh pr view https://github.com/owner/repo/pull/55.
When the user asks to land or merge a PR, the terminal outcome is the PR's verified GitHub state, not the end of a review, worker turn, or CI observation.
gh pr view ... --json state,mergedAt,mergeCommit
proves state is MERGED.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 ..."
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
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}'
Use --json + --jq for structured output. Use --body-file for comments/bodies containing backticks, shell snippets, env names, or user text.