Skip to content
Latchkey

gh pr view: Usage, Options & Common CI Errors

Inspect a single pull request - body, status, checks, and more.

gh pr view shows the details of one pull request: title, body, state, reviews, and CI checks. It defaults to the current branch’s PR or takes a number, branch, or URL.

What it does

gh pr view prints a PR’s metadata and body. With --json it returns structured fields (state, mergeable, reviewDecision, statusCheckRollup) for gating logic, and --web opens the PR in a browser. Without an argument it resolves the PR associated with the current branch.

Common usage

Terminal
# View the PR for the current branch
gh pr view

# View a specific PR by number, with comments
gh pr view 42 --comments

# JSON for CI gating (e.g. require approval before deploy)
gh pr view 42 --json state,reviewDecision,mergeable --jq '.reviewDecision'

Common error in CI: no PR found for the current branch

gh pr view fails with "no pull requests found for branch" when CI checks out a detached HEAD or the branch has no PR. Fix: pass an explicit PR number, branch, or URL (gh pr view 42 --repo owner/name) instead of relying on branch resolution, which is unreliable in detached-HEAD CI checkouts. To gate on review state, read reviewDecision (APPROVED / CHANGES_REQUESTED / REVIEW_REQUIRED) via --json.

Key options

OptionPurpose
[number|branch|url]Which PR to view
-c, --commentsInclude comments
--json FIELDSOutput structured fields
-w, --webOpen in a browser

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →