View PR (GitHub)
Purpose
Read pull request status/details from GitHub.
Priority order:
- •FIRST: Use GitHub MCP tools - stable, structured, no pager/editor issues
- •SECOND: Use
scripts/pr-github.shwrapper (for create/merge only) - •LAST: Use
ghCLI as final fallback
Use this skill for read-only PR inspection (status, checks, reviewers, files, body). For creating/merging PRs, use the create-pr-github skill.
GitHub MCP Tools (Preferred)
Use these GitHub MCP tools for PR operations:
PR Details and Metadata
github-mcp-server-pull_request_read method: "get" owner: "oocx" repo: "tfplan2md" pullNumber: 123
Returns: PR number, title, state, body, author, timestamps, merge status, etc.
PR Diff
github-mcp-server-pull_request_read method: "get_diff" owner: "oocx" repo: "tfplan2md" pullNumber: 123
Returns: Full diff of the PR changes
PR Status Checks
github-mcp-server-pull_request_read method: "get_status" owner: "oocx" repo: "tfplan2md" pullNumber: 123
Returns: Status of CI/CD checks, required checks, conclusion
PR Changed Files
github-mcp-server-pull_request_read method: "get_files" owner: "oocx" repo: "tfplan2md" pullNumber: 123 perPage: 100
Returns: List of files changed with stats (additions, deletions, changes)
PR Review Comments (inline on code)
github-mcp-server-pull_request_read method: "get_review_comments" owner: "oocx" repo: "tfplan2md" pullNumber: 123 perPage: 100
Returns: Code review comments with file paths, line numbers, and comment bodies
PR Reviews
github-mcp-server-pull_request_read method: "get_reviews" owner: "oocx" repo: "tfplan2md" pullNumber: 123 perPage: 100
Returns: Review submissions with state (APPROVED, CHANGES_REQUESTED, etc.)
PR Conversation Comments
github-mcp-server-pull_request_read method: "get_comments" owner: "oocx" repo: "tfplan2md" pullNumber: 123 perPage: 100
Returns: General conversation comments on the PR
List PRs
github-mcp-server-list_pull_requests owner: "oocx" repo: "tfplan2md" state: "open" # or "closed", "all" perPage: 30 page: 1
Returns: List of PRs with basic metadata
GitHub CLI Fallback (Last Resort)
⚠️ Only use when GitHub MCP tools are unavailable
Hard Rules
- •Prefer GitHub MCP tools when they can answer the question
- •If using
gh, use a non-interactive pager for everyghcall:- •Use
GH_PAGER=cat(gh-specific, overrides gh's internal pager logic) - •Also set
GH_FORCE_TTY=falseto reduce TTY-driven behavior - •Prefer structured output (
--json) and keep output small with--jqwhen practical
- •Use
- •Never run plain
gh ...withoutGH_PAGER=cat(it may openlessand block) - •Never change global GitHub CLI config (no
gh config set ...)
Fallback gh Patterns
Use this prefix for every command:
GH_PAGER=cat GH_FORCE_TTY=false gh ...
View PR Summary
GH_PAGER=cat GH_FORCE_TTY=false gh pr view <pr-number> \ --json number,title,state,isDraft,url,mergeStateStatus,reviewDecision
View Status Checks
GH_PAGER=cat GH_FORCE_TTY=false gh pr view <pr-number> \
--json statusCheckRollup \
--jq '.statusCheckRollup[] | {name, status, conclusion}'
View Reviews
GH_PAGER=cat GH_FORCE_TTY=false gh pr view <pr-number> \
--json latestReviews,reviewRequests \
--jq '{latestReviews: [.latestReviews[] | {author: .author.login, state, submittedAt}], reviewRequests: [.reviewRequests[].login]}'
When To Use Different Approaches
Prefer GitHub MCP Tools when
- •You need structured PR metadata (details, changed files, status checks, comments, reviews)
- •You want to avoid terminal-side pitfalls (auth prompts, pager behavior, large output)
- •You want operations that can be permanently allowed in VS Code
- •You're in any VS Code Copilot context (chat, inline, etc.)
Prefer Wrapper Scripts when
- •You're creating or merging a PR: use
scripts/pr-github.sh create/scripts/pr-github.sh create-and-merge
Prefer gh CLI when (rare)
- •You need an API surface the MCP tools don't expose (use
gh apifor custom calls) - •You need commands for Maintainers to reproduce locally
- •A maintainer explicitly requests CLI examples
Rule of thumb: Always start with GitHub MCP tools; only fall back to wrapper scripts for create/merge, and only use gh CLI as final resort.