| name | gh-master |
| version | 1.0.0 |
| description | GitHub CLI mastery — PRs, issues, releases, Actions, code search, and raw API calls via gh |
| author | ninetrix |
| tags | ["github","developer","ci-cd"] |
| requires | {"tools":["gh","bash"]} |
| companion_tool | gh |
GitHub CLI Master
Full GitHub operations from the terminal using gh. Covers PRs, issues, releases, CI/CD, and the API escape hatch.
When this applies
- Managing pull requests (create, review, merge, diff)
- Triaging issues (list, create, comment, close)
- Monitoring or triggering CI/CD workflow runs
- Creating releases and tags
- Searching code or repositories
- Any GitHub operation
Auth
gh authenticates via GITHUB_TOKEN env var or gh auth login. Check with gh auth status.
Pull Requests
gh pr list
gh pr list --state merged --limit 5
gh pr view 42
gh pr diff 42
gh pr create --title "feat: X" --body "..."
gh pr create --draft
gh pr review 42 --approve
gh pr review 42 --request-changes -b "fix X"
gh pr merge 42 --squash --delete-branch
gh pr checks 42
gh pr checkout 42
Issues
gh issue list
gh issue list --label bug --state open
gh issue view 15
gh issue create --title "Bug: X" --body "..."
gh issue comment 15 --body "update: ..."
gh issue close 15 --reason completed
gh issue reopen 15
gh issue edit 15 --add-label priority
CI/CD — Workflow Runs
gh run list
gh run list --workflow ci.yml --branch main
gh run view 123456
gh run view 123456 --log-failed
gh run rerun 123456 --failed
gh workflow run deploy.yml -f env=prod
gh workflow list
Releases
gh release list
gh release view v1.2.0
gh release create v1.3.0 --title "v1.3.0" --notes "changelog"
gh release create v1.3.0 --generate-notes
gh release create v2.0.0-rc1 --prerelease
gh release upload v1.3.0 dist/*.tar.gz
Search
gh search repos "agent framework" --language python --sort stars
gh search code "def run_agent" --repo owner/repo
gh search issues "memory leak" --repo owner/repo --state open
gh search prs "fix auth" --repo owner/repo
Repo Operations
gh repo view owner/repo
gh repo clone owner/repo
gh repo fork owner/repo
gh repo create my-repo --public
API Escape Hatch
For anything not covered by specific commands:
gh api /repos/owner/repo
gh api /repos/owner/repo/labels -f name=bug -f color=d73a4a
gh api graphql -f query='{ viewer { login }}'
gh api /repos/owner/repo/actions/runners --jq '.[].name'
Decision Rules
- Need PR CI status before merging →
gh pr checks 42
- CI failed →
gh run view ID --log-failed to see why, then gh run rerun ID --failed
- Need something not covered →
gh api handles any GitHub endpoint
- Large diff →
gh pr diff 42 | head -200 to avoid overwhelming output
- Check if issue exists before creating →
gh search issues "error message" --repo owner/repo
Do
- Use
--json flag + --jq for structured output: gh pr list --json number,title --jq '.[].title'
- Use
--squash merge by default (cleaner history)
- Link issues in PR body with
Closes #N
- Check
gh pr checks before merging
- Use
gh run view --log-failed to diagnose CI failures
Don't
- Merge PRs with failing checks (breaks main)
- Force-merge without user confirmation (irreversible)
- Use
gh api with DELETE without user confirmation (destructive)
- Create releases without checking latest version first (
gh release list)
- Rerun failed CI more than once without investigating logs (masks real failures)