| name | github |
| description | GitHub operations: manage repos, issues, PRs, CI checks, gists, and releases via gh CLI. Use when user asks about GitHub repos, issues, pull requests, or CI. |
| version | 1.0.0 |
| requires | {"bins":["gh"]} |
| always | false |
GitHub
Manage GitHub repositories, issues, pull requests, CI, releases, and more via the gh CLI.
Setup
The gh CLI handles authentication natively — no API keys or tokens needed.
gh auth login
gh auth status
Usage
Call gh directly via the exec tool. Always use non-interactive flags (--yes, --body instead of editor, --confirm where available) since the agent cannot interact with prompts.
Repos
gh repo list
gh repo list ORG --limit 50
gh repo view
gh repo view OWNER/REPO
gh repo clone OWNER/REPO
gh repo create REPO --public --description "Description"
Issues
gh issue list
gh issue list --state closed --label bug --assignee @me
gh issue view 42
gh issue create --title "Bug title" --body "Description" --label bug
gh issue close 42
gh issue reopen 42
gh issue comment 42 --body "Comment text"
gh issue edit 42 --title "New title" --add-label enhancement
Pull Requests
gh pr list
gh pr view 42
gh pr diff 42
gh pr checks 42
gh pr create --title "PR title" --body "Description" --base main
gh pr create --title "WIP: feature" --body "Description" --draft
gh pr merge 42 --squash --delete-branch
gh pr review 42 --approve
gh pr review 42 --request-changes --body "Needs fix"
gh pr review 42 --comment --body "Looks good overall"
gh pr checkout 42
CI / Workflow Runs
gh run list
gh run list --workflow build.yml
gh run view 12345
gh run view 12345 --log
gh run watch 12345
gh run rerun 12345
gh workflow run build.yml --ref main
Releases
gh release list
gh release view --latest
gh release create v1.0.0 --title "v1.0.0" --notes "Release notes here"
gh release create v1.0.0 --generate-notes
gh release upload v1.0.0 dist/*.tar.gz
Gists
gh gist list
gh gist create file.txt --desc "Description" --public
gh gist view GIST_ID
gh gist edit GIST_ID --add newfile.txt
Search
gh search repos "query" --language typescript --sort stars
gh search issues "query" --repo OWNER/REPO --state open
gh search prs "query" --repo OWNER/REPO --state merged
gh search code "function_name" --repo OWNER/REPO
API (Advanced)
For anything not covered by built-in commands, use gh api directly:
gh api repos/OWNER/REPO
gh api repos/OWNER/REPO/pulls --jq '.[].title'
gh api repos/OWNER/REPO/issues -f title="Title" -f body="Body"
gh api repos/OWNER/REPO/issues --paginate --jq '.[].title'
gh api graphql -f query='{ viewer { login } }'
Output Formatting
Use --json and --jq for structured, parseable output:
gh pr list --json number,title,state
gh pr list --json number,title,state --jq '.[] | select(.state=="OPEN") | .title'
gh issue view 42 --json title,body,labels,assignees
Important Rules
- Never use interactive flags — always pass
--body, --title, --yes etc. directly. The agent cannot respond to editor prompts or confirmations.
- Prefer
--json output for structured data that needs further processing.
- Use
--jq to filter large JSON responses down to needed fields.
- Rate limiting: GitHub API has rate limits (5,000 req/hour for authenticated users). For bulk operations, pace requests. If you hit a rate limit,
gh will report it — wait and retry.
- Repository context: Most commands auto-detect the repo from the current git remote. Use
-R OWNER/REPO to target a different repo.
Troubleshooting
- Not authenticated: Run
gh auth login to authenticate.
- Permission denied: Ensure the authenticated user has access to the repo/org.
- Rate limited: Wait for the reset window (usually < 1 hour) or reduce request frequency.
- Command not found: Install gh —
brew install gh (macOS), sudo apt install gh (Linux).