github-mcp-server
github-mcp-server copied to clipboard
fix: fall back when get_check_runs lacks Checks API access
Summary
- Add tiered fallbacks for
pull_request_readget_check_runswhen the Checks API returns 403 - Retry via Actions workflow runs (filtered by head SHA), then commit statuses
- Return a
sourcefield 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
sourcetoMinimalCheckRunsResult(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)
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.