Skip to content

Conversation

@kaitlin-duolingo
Copy link

Summary

Add get_check_runs method to the pull_request_read tool to fetch CI/CD check run status for a pull request's head commit.

Why

Fixes #1942

AI tools cannot easily determine which CI/CD checks are failing on a pull request. The existing get_status method returns combined commit status but not individual check runs (GitHub Actions jobs, third-party checks).

What changed

  • Added get_check_runs as option 8 in pull_request_read method enum
  • Added GetPullRequestCheckRuns function using GitHub Checks API
  • Added MinimalCheckRun and MinimalCheckRunsResult types to reduce response size
  • Added test endpoint constant and unit tests

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
    • Added new get_check_runs method value to the existing pull_request_read tool's method enum.
  • New tool added

Prompts tested (tool changes only)

  • "Which CI checks are failing on my PR?"
  • "Show me the status of all checks on this pull request"
  • "Is my PR ready to merge?"

Security / limits

  • No security or limits impact
  • Auth / permissions considered
    • Uses existing scopes.Repo scope, same as other PR read methods.
  • Data exposure, filtering, or token/size limits considered
    • Returns minimal check run fields only (excludes verbose Output, CheckSuite, App, PullRequests objects) to conserve context tokens.

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test
    • Ran go test -run Test_GetPullRequestCheckRuns ./pkg/github/... - all tests pass.

Docs

  • Updated (README / docs / examples)

@kaitlin-duolingo kaitlin-duolingo requested a review from a team as a code owner February 3, 2026 22:20
Copilot AI review requested due to automatic review settings February 3, 2026 22:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for retrieving per-job CI/CD check run status for a pull request by introducing a new get_check_runs method on the existing pull_request_read tool (fixes #1942).

Changes:

  • Extended pull_request_read tool schema/enum with get_check_runs and documented it in README/toolsnap.
  • Implemented GetPullRequestCheckRuns using the GitHub Checks API and a minimal response shape to reduce payload size.
  • Added unit tests and a mock endpoint constant for the check-runs API route.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/github/pullrequests.go Adds the new get_check_runs method and implements the check-runs retrieval via GitHub Checks API.
pkg/github/minimal_types.go Introduces minimal types and conversion helper for check run output shaping.
pkg/github/pullrequests_test.go Adds unit tests covering success and failure paths for get_check_runs.
pkg/github/helper_test.go Adds mock route constant for GET /repos/{owner}/{repo}/commits/{ref}/check-runs.
pkg/github/toolsnaps/pull_request_read.snap Updates tool schema snapshot to include the new method enum value and description.
README.md Updates tool documentation to include the new get_check_runs method.

Comment on lines +282 to +283
defer func() { _ = resp.Body.Close() }()

Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deferred response-body closer captures the resp variable by reference, but resp is reassigned later when calling client.Checks.ListCheckRunsForRef. This means the first defer will end up closing the second response body (and the PR response body may never be closed), potentially leaking connections. Use defer resp.Body.Close() (evaluated at defer time) or capture resp.Body in the deferred function’s arguments so each response is closed correctly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add check_runs support

1 participant