What problem does it solve?
Interact with GitHub programmatically to manage issues, pull requests, CI runs, and repository data without switching context to the web UI.
Core Features & Use Cases
- Issue and PR management via gh commands, including checks, creation, and status queries.
- CI and workflow visibility: list runs, inspect individual runs, and fetch logs for failed steps.
- API access and data retrieval: query repository data using gh api with JSON outputs for automation and reporting.
- Use Case: Suppose you need to report weekly PR health across multiple repos; run a script that fetches PR counts, checks status, and labels results in a dashboard.
Quick Start
Use the gh CLI to interact with GitHub. Always specify --repo owner/repo when not in a git directory, or use URLs directly.
- Check CI status on a PR: gh pr checks 55 --repo owner/repo
- List recent workflow runs: gh run list --repo owner/repo --limit 10
- View a run and its logs: gh run view <run-id> --repo owner/repo
- View failed step logs: gh run view <run-id> --repo owner/repo --log-failed
- Get PR details via API: gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
- List issues with details: gh issue list --repo owner/repo --json number,title --jq '.[] | "(.number): (.title)"'