Skip to content
Software capabilities

GitHub capability

Read checks on a GitHub pull request

Use gh pr checks for a pull request’s check summary. Use the Checks API for structured check runs on a specific commit.

Documentation reviewed

Ways to do it

API

GET /repos/{owner}/{repo}/commits/{ref}/check-runs

Read check names, states, and conclusions from a commit or other Git ref.

Requirements
Repository and Git ref. Use the pull request head SHA for the checks on that commit. Private access with a fine-grained token requires Checks read permission.
Limitations
The default filter is latest. Use filter=all when you need earlier check runs as well.

Example

curl --fail -H "Authorization: Bearer $GITHUB_TOKEN" \
  "https://api.github.com/repos/$OWNER/$REPO/commits/$HEAD_SHA/check-runs"
Read source: GitHub REST API check runs

CLI

gh pr checks <pull-request>

Show checks for one pull request. Add --required to focus on checks required for merging.

Requirements
GitHub CLI with repository access and a pull request number, URL, or branch.
Limitations
Pending checks can produce exit code 8. Scripts need to account for that separately from a failed check.

Example

gh pr checks "$PR_NUMBER" --repo "$OWNER/$REPO" --required
Read source: GitHub CLI pull request checks