| name | github-cli |
| description | GitHub CLI (gh) commands for PR workflows - checking CI status, viewing failed test logs, creating and updating pull requests. Use when working with GitHub PRs, checking why CI failed, or managing PR metadata. |
GitHub CLI for PR Workflows
Quick reference for gh commands focused on pull request workflows.
Checking PR Status
gh pr checks
gh pr checks 123
gh pr checks --watch
gh pr checks --required
gh pr checks --json name,state,conclusion
Exit codes: 0 = passed, 1 = failed, 8 = pending
Viewing Failed Test Logs
gh run view
gh run view <run-id> -v
gh run view <run-id> --log-failed
gh run view --job <job-id> --log
gh run view <run-id> --web
To get job ID from a URL like .../runs/123/job/456, job ID is 456.
Creating PRs
gh pr create
gh pr create --title "Fix bug" --body "Details here"
gh pr create --fill
gh pr create --draft
gh pr create -r reviewer1,reviewer2 -l bug,urgent
gh pr create --base develop
Updating PRs
gh pr edit 123 --title "New title" --body "New body"
gh pr edit 123 --add-label "bug" --remove-label "wip"
gh pr edit 123 --add-reviewer alice --remove-reviewer bob
gh pr edit 123 --add-assignee "@me"
gh pr edit 123 --base main
Other Useful Commands
gh pr view 123
gh pr view 123 --web
gh pr list
gh pr checkout 123
gh api repos/{owner}/{repo}/issues/123/comments
gh run rerun <run-id> --failed
Scripts
scripts/check-pr.sh - Check PR status with optional watch mode
scripts/view-failed-logs.sh - View failed logs for a run or job