# gh pr status: Pull Requests Relevant to You

> gh pr status summarizes the PRs you created, are assigned, or are requested to review. Reference for --json, the current-branch PR, and CI auth errors.

Source: https://latchkey.dev/learn/command-reference/gh-pr-status  
Updated: 2026-06-30

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

| Flag | What 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-status | Show 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.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### gh pr status: Pull Requests Relevant to You?

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.

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
