github-mcp-server icon indicating copy to clipboard operation
github-mcp-server copied to clipboard

fix: fall back when get_check_runs lacks Checks API access

Open advancedresearcharray opened this issue 5 months ago • 1 comments

Summary

  • Add tiered fallbacks for pull_request_read get_check_runs when the Checks API returns 403
  • Retry via Actions workflow runs (filtered by head SHA), then commit statuses
  • Return a source field indicating which API supplied the data
  • Provide clearer permission guidance when all sources are denied

Why

Fixes #2381. Hosted MCP tokens often lack checks:read even though other PR read methods work and the equivalent REST call succeeds with the caller's PAT. This makes get_check_runs unusable in that environment.

What changed

  • Extracted check-runs logic into pkg/github/check_runs.go
  • On Checks API 403, fall back to workflow runs and commit statuses
  • Added converters for workflow runs and commit statuses to MinimalCheckRun
  • Added source to MinimalCheckRunsResult (checks_api, workflow_runs, commit_statuses)
  • Added unit tests for fallback paths and converters

Test plan

  • [x] go test -run Test_GetPullRequestCheckRuns ./pkg/github/...
  • [x] go test -run Test_convertWorkflowRun ./pkg/github/...
  • [x] go test -run Test_convertCommitStatus ./pkg/github/...
  • [x] go test ./pkg/github/... (no regressions)

advancedresearcharray avatar Jun 06 '26 08:06 advancedresearcharray

Merge-ready check-in

This PR looks ready for maintainer review/merge when you have a moment.

  • Change: fix: fall back when get_check_runs lacks Checks API access
  • CI: green / passing
  • Review: REVIEW_REQUIRED (mergeable: MERGEABLE)

Happy to rebase or address any remaining feedback. Thanks for maintaining the project.

advancedresearcharray avatar Jun 12 '26 17:06 advancedresearcharray