Query GitHub using gh CLI - check CI/CD pipelines, view issues, and inspect pull requests. READ-ONLY by default - always ask user approval before creating, merging, or modifying issues/PRs. Triggers: CI/CD failures, PR reviews, issue tracking, workflow runs, GitHub Actions, repository status.
Query GitHub for CI/CD pipeline monitoring, issue tracking, and pull request inspection using the gh CLI. This skill is READ-ONLY by default.
ALWAYS invoke this skill when the user's request involves ANY of these:
gh CLI operationIf the user asks about CI, PRs, issues, or GitHub workflows, use this skill.
NEVER (without explicit user approval):
gh issue create, gh issue close, , gh issue editgh issue commentgh pr create, gh pr merge, gh pr close, gh pr edit, gh pr reviewgh run rerun, gh workflow rungh label create, gh label deleteALWAYS allowed (read-only):
gh run list, gh run view, gh run watchgh issue list, gh issue viewgh pr list, gh pr view, gh pr diff, gh pr checksgh workflow list, gh workflow viewgh repo viewgh auth status--json query or inspection commandBefore any state-changing operation, ask:
I need to run a state-changing GitHub command:
Command: gh pr merge 123 --squash
Impact: Will merge PR #123 into main branch
Repository: owner/repo
Do you approve? (yes/no)
| Task | Command |
|---|---|
| Check auth | gh auth status |
| List failed runs | gh run list --status failure |
| View run logs | gh run view <id> --log-failed |
| List open PRs | gh pr list |
| View PR checks | gh pr checks <number> |
| List open issues | gh issue list |
| View repo | gh repo view |
# List recent workflow runs
gh run list
# List runs for specific workflow
gh run list --workflow build.yml
# List runs for specific branch
gh run list --branch main
# List only failed runs
gh run list --status failure
# JSON output for parsing
gh run list --json status,conclusion,name,headBranch,createdAt
# View specific run
gh run view <run-id>
# View run with job details
gh run view <run-id> --json jobs
# View failed steps
gh run view <run-id> --json jobs --jq '.jobs[] | select(.conclusion=="failure") | {name, steps: [.steps[] | select(.conclusion=="failure")]}'
# Get run URL
gh run view <run-id> --json url -q .url
# View logs for failed jobs only
gh run view <run-id> --log-failed
# Download logs to file
gh run view <run-id> --log > run-logs.txt
# View specific job logs
gh run view <run-id> --job <job-id> --log
# Watch run in progress (live updates)
gh run watch <run-id>
# Watch and exit with run's exit code
gh run watch <run-id> --exit-status
# Rerun failed jobs only - ASK APPROVAL FIRST
gh run rerun <run-id> --failed
# Rerun entire workflow - ASK APPROVAL FIRST
gh run rerun <run-id>
# List open issues
gh issue list
# List all issues (including closed)
gh issue list --state all
# List issues assigned to me
gh issue list --assignee @me
# List issues by label
gh issue list --label bug
# Search issues
gh issue list --search "memory leak"
# JSON output
gh issue list --json number,title,state,labels,assignees
# View issue details
gh issue view <issue-number>
# View in browser
gh issue view <issue-number> --web
# View with comments
gh issue view <issue-number> --comments
# JSON output
gh issue view <issue-number> --json title,body,state,labels,assignees,comments
# Create issue - ASK APPROVAL FIRST
gh issue create --title "Bug: Application crashes" --body "Steps to reproduce..."
# Add comment - ASK APPROVAL FIRST
gh issue comment <issue-number> --body "Working on this"
# Close issue - ASK APPROVAL FIRST
gh issue close <issue-number>
# List open PRs
gh pr list
# List my PRs
gh pr list --author @me
# List PRs for review
gh pr list --search "review-requested:@me"
# List PRs by label
gh pr list --label "needs-review"
# JSON output
gh pr list --json number,title,state,author,reviewDecision,mergeable
# View PR details
gh pr view <pr-number>
# View in browser
gh pr view <pr-number> --web
# View PR diff
gh pr diff <pr-number>
# View PR checks/CI status
gh pr checks <pr-number>
# Watch PR checks (live)
gh pr checks <pr-number> --watch
# JSON output
gh pr view <pr-number> --json title,body,state,reviews,comments,commits,files
# Checkout PR branch
gh pr checkout <pr-number>
# Create PR - ASK APPROVAL FIRST
gh pr create --title "Add feature X" --body "Description..."
# Add comment - ASK APPROVAL FIRST
gh pr comment <pr-number> --body "LGTM!"
# Merge PR - ASK APPROVAL FIRST
gh pr merge <pr-number> --squash
# 1. List recent failed runs
gh run list --status failure --limit 10
# 2. Get details of failed run
gh run view <run-id>
# 3. View failed job logs
gh run view <run-id> --log-failed
# 4. Get specific job details
gh run view <run-id> --json jobs --jq '.jobs[] | select(.conclusion=="failure")'
# 5. View step-by-step failure
gh run view <run-id> --json jobs --jq '.jobs[] | select(.conclusion=="failure") | .steps[] | select(.conclusion=="failure") | {name, conclusion}'
# Check if main branch is green
gh run list --branch main --limit 1 --json conclusion -q '.[0].conclusion'
# Find flaky tests
gh run list --workflow test.yml --limit 50 --json conclusion,headBranch | jq 'group_by(.headBranch) | .[] | select(length > 1)'
# JSON output (for jq processing)
gh issue list --json number,title,state
# Specific field with jq
gh pr view 123 --json reviews --jq '.reviews[].state'
# Table format
gh issue list --json number,title,state --jq '.[] | [.number, .title, .state] | @tsv'
| Issue | Cause | Fix |
|---|---|---|
| "Not authenticated" | gh not logged in | gh auth login |
| "Repository not found" | Wrong repo context | Use --repo owner/repo or gh repo set-default |
| "No workflows found" | Missing workflow files | Check .github/workflows/ exists |
| "Permission denied" | Insufficient token scope | Re-auth with gh auth login |
| "Rate limit exceeded" | Too many API calls | Wait or authenticate for higher limits |
| Command hangs | Interactive prompt expected | Add --yes flag or provide all required args |
| User Request | Action |
|---|---|
| "Why is CI failing?" | gh run list --status failure, then gh run view <id> --log-failed |
| "Check my PR status" | gh pr checks <number> or gh pr view <number> |
| "List open issues" | gh issue list |
| "What PRs need my review?" | gh pr list --search "review-requested:@me" |
| "Merge PR 123" | Ask approval, then gh pr merge 123 --squash |
| "Create an issue for this bug" | Ask approval, then gh issue create --title "..." --body "..." |
| "Rerun the failed tests" | Ask approval, then gh run rerun <id> --failed |
Before ANY state-changing operation:
| Category | Commands Requiring Approval |
|---|---|
| Workflows | run rerun, workflow run |
| Issues | issue create, issue close, issue edit, issue comment, issue reopen |
| PRs | pr create, pr merge, pr close, pr edit, pr comment, pr review, pr ready |
| Labels | label create, label edit, label delete |
| Projects | project item-add |