PR readiness
pr_readinessVerifies a GitHub pull request is ready to merge using live data, returning a verdict with blocking reasons, owner, commit SHA, and timestamp.
Instructions
Check whether a GitHub pull request is verified ready to merge, from live GitHub data.
Call it before you say a PR is ready, green, mergeable or done; after every push; and again immediately before any final claim. Pass expected_head_sha = the full sha from git rev-parse HEAD after your push.
verdict: ready | not_ready | merged | closed. ready means GitHub's merge state is CLEAN, every check on the head passed, no review decision blocks, the PR is not queued, and the head is the one you expected. Stricter than the merge button: an optional failing or running check also blocks. not_ready means not verified ready; reasons say why.
Each reason has a code, an owner, a detail and a fix. The codes mergeable_unknown, checks_missing, stale_head and unsupported_merge_state mean "cannot verify yet": report them as that, not as a defect. Every other code is a known obstacle, checks_pending and blocked_by_branch_rule included. owner (author | reviewer | wait | unknown) says whose move it is; it is not permission to act and not a claim that anything else is clear.
This tool reads; it never merges, publishes a draft, pushes or rewrites history, and its verdict does not authorise you to. Ready, green, merged and done are different words: use the one the verdict supports, with head_sha and checked_at.
Errors come back as isError with JSON text {code, message, retryable, retry_after_seconds?}.
Example: {"pr": "octo-org/widgets#42", "expected_head_sha": "4f1c2e7a9b0d3c6e8f1a2b4c5d6e7f8091a2b3c4"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pr | Yes | The pull request: "owner/repo#42" or "https://github.com/owner/repo/pull/42". GitHub.com only. | |
| expected_head_sha | No | The full 40-character sha you expect at the PR head: run `git rev-parse HEAD` after your push. If the PR head differs, the verdict is not_ready with stale_head. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pr | Yes | The canonical PR URL. | |
| facts | Yes | ||
| reasons | Yes | Every reason the PR is not verified ready. Empty when ready, merged or closed. | |
| verdict | Yes | ready only when reasons is empty. not_ready means not verified ready; reasons say why. | |
| head_sha | Yes | The PR head commit this verdict is for. | |
| checked_at | Yes | When GitHub was read (ISO 8601). An observation, not a lease. |