Skip to content
Latchkey

gh pr status: Pull Requests Relevant to You

gh pr status shows the pull request for the current branch plus PRs you opened or need to review.

In automation gh pr status is a quick way to discover the PR tied to the branch a job is running on, without hardcoding a number.

What it does

gh pr status prints three groups: the pull request for the current branch, PRs you created, and PRs requesting your review. With --json it returns the same data as structured fields for scripting.

Common usage

Terminal
gh pr status
gh pr status --json number,title,state
gh pr status -R owner/repo

Flags

FlagWhat it does
--json <fields>Output the current-branch PR as JSON fields
-q, --jq <expression>Filter JSON output with a jq expression
-t, --template <string>Format JSON output with a Go template
-c, --conflict-statusShow merge conflict status
-R, --repo <owner/repo>Target a specific repository

In CI

Export GH_TOKEN and add permissions: { pull-requests: read }. The "created by you" and "requesting a review" groups are empty for github-actions[bot], so in workflows rely on the current-branch PR via --json number rather than the personal groups.

Common errors in CI

"gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable" means GH_TOKEN is unset. "no pull requests found for branch" with --json number returns an empty object; guard against it before reading .number. "could not determine base repository" appears outside a git checkout; pass -R owner/repo.

Related guides

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