Skip to content
LatchkeyLatchkey home

gh pr ready: Mark a Pull Request Ready

gh pr ready flips a draft pull request to ready for review, or back to draft with --undo.

Automation often opens a draft PR, waits for generated content or checks, then promotes it. gh pr ready is the promote step.

What it does

gh pr ready marks a draft pull request as ready for review, which triggers required reviewers and review-gated checks. With --undo it converts a ready PR back to draft.

Common usage

Terminal
gh pr ready 123
gh pr ready 123 --undo
gh pr ready -R owner/repo 123

Flags

FlagWhat it does
--undoConvert the pull request back to a draft
-R, --repo <owner/repo>Target a specific repository

In CI

Set GH_TOKEN and add permissions: { pull-requests: write }. Note GITHUB_TOKEN cannot create or convert PRs in a way that triggers other workflows; if you need the ready event to start downstream workflows, use a PAT or a GitHub App token instead of the default token.

Common errors in CI

"GraphQL: Resource not accessible by integration" means the token lacks pull-requests: write or the action is on a fork without write access. "could not determine base repository" means no PR context; pass the number and -R. Converting an already-ready PR without --undo is a no-op, not an error.

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

Frequently asked questions

gh pr ready: Mark a Pull Request Ready?
Automation often opens a draft PR, waits for generated content or checks, then promotes it. gh pr ready is the promote step.
What it does?
gh pr ready marks a draft pull request as ready for review, which triggers required reviewers and review-gated checks. With --undo it converts a ready PR back to draft.
In CI?
Set GH_TOKEN and add permissions: { pull-requests: write }. Note GITHUB_TOKEN cannot create or convert PRs in a way that triggers other workflows; if you need the ready event to start downstream workflows, use a PAT or a GitHub App token instead of the default token.
Common errors in CI?
"GraphQL: Resource not accessible by integration" means the token lacks pull-requests: write or the action is on a fork without write access. "could not determine base repository" means no PR context; pass the number and -R. Converting an already-ready PR without --undo is a no-op, not an error.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card