gh

CLI>=2.0

GitHub's official CLI for managing repos, PRs, issues, and more.

GitHub CLI for PRs, issues, repos, and Actions from the terminal

6 of 9 recipes verified by execution · 2026-09-17#github#pr#issues#ci

Verified commands

Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.

List open pull requests as JSON

Verified macOS · 2026-09-17
gh pr list --repo OWNER/REPO --state open --limit 5 --json number,title
Common failures (1)
  • fatal: not a git repositoryoutside a checkout gh cannot infer the repo: pass --repo OWNER/REPO

List open issues as JSON

Verified macOS · 2026-09-17
gh issue list --repo OWNER/REPO --state open --limit 5 --json number,title

Show recent CI runs

Verified macOS · 2026-09-17
gh run list --repo OWNER/REPO --limit 3 --json status,conclusion,name

Get the conclusion of the latest CI run

Verified macOS · 2026-09-17
gh run list --repo OWNER/REPO --limit 1 --json databaseId --jq '.[0].databaseId' | xargs -I{} gh run view {} --repo OWNER/REPO --json conclusion

Read one field from the GitHub API

Verified macOS · 2026-09-17
gh api repos/OWNER/REPO --jq .default_branch

Inspect a pull request

Verified macOS · 2026-09-17
gh pr view 42 --repo OWNER/REPO --json state,title

More recipes

Curated from documentation and usage. Percentages are estimates, not measurements.

Create a pull request with a multi-line body

~97% est.
gh pr create --title 'feat: add feature' --body-file pr.md
Common failures (1)
  • body shows literal \nwrite the body to a file and pass --body-file instead of --body

Watch the current CI run until it finishes

~95% est.
gh run watch --exit-status

Clone a repo

~99% est.
gh repo clone owner/repo

Install

Homebrewbrew install gh

Agent notes

When to use
Managing GitHub workflows without the browser
Quick examples
  • gh pr create
  • gh issue list --label bug
  • gh run watch

Use from an agent

curl -s https://clihub.com/api/tools/gh | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug gh on the MCP server at https://clihub.com/mcp.

Homepage ↗Repository ↗MIT0 views