Repository navigation
Migrate to GitHub REST API version 2026-03-10 - #3038
Open
maxffarrell wants to merge 8 commits into
Open
maxffarrell wants to merge 8 commits into
maxffarrell wants to merge 8 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates REST requests to GitHub API version 2026-03-10.
Changes:
- Centralizes the API-version header and transport.
- Applies the version to REST clients, scope discovery, and GitHub App authentication.
- Adds request-path coverage.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/http/headers/headers.go |
Defines the API version. |
pkg/http/transport/api_version.go |
Adds the versioning transport. |
pkg/http/transport/api_version_test.go |
Tests transport behavior. |
internal/ghmcp/server.go |
Versions stdio REST clients. |
internal/ghmcp/oauth_test.go |
Tests stdio requests. |
pkg/github/dependencies.go |
Versions per-request clients. |
pkg/github/dependencies_test.go |
Tests per-request clients. |
pkg/scopes/fetcher.go |
Updates scope discovery. |
pkg/scopes/fetcher_test.go |
Tests scope headers. |
internal/githubapp/githubapp.go |
Updates token requests. |
internal/githubapp/githubapp_test.go |
Tests token-request headers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // and shadow the dynamic one. | ||
| restUATransport := &transport.UserAgentTransport{ | ||
| Transport: http.DefaultTransport, | ||
| Transport: &transport.APIVersionTransport{Transport: http.DefaultTransport}, |
| // Construct REST client | ||
| restClient, err := gogithub.NewClient( | ||
| gogithub.WithHTTPClient(&http.Client{ | ||
| Transport: &transport.APIVersionTransport{Transport: http.DefaultTransport}, |
| req.Header.Set(headers.AuthorizationHeader, "Bearer "+token) | ||
| req.Header.Set(headers.AcceptHeader, "application/vnd.github+json") | ||
| req.Header.Set(headers.GitHubAPIVersionHeader, "2022-11-28") | ||
| req.Header.Set(headers.GitHubAPIVersionHeader, headers.GitHubAPIVersion) |
| req.Header.Set("X-GitHub-Api-Version", "2022-11-28") | ||
| req.Header.Set(headers.AuthorizationHeader, "Bearer "+jwt) | ||
| req.Header.Set(headers.AcceptHeader, "application/vnd.github+json") | ||
| req.Header.Set(headers.GitHubAPIVersionHeader, headers.GitHubAPIVersion) |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Suppressed comments (1)
pkg/http/transport/api_version.go:11
- Non-blocking: the exported type documentation says this transport only handles cloud requests, but
RoundTripalso pins GHES requests to the compatibility version. Include GHES so the documented public behavior matches the implementation.
// APIVersionTransport sets the GitHub REST API version on requests to
// GitHub.com and GitHub Enterprise Cloud.
…026-03-10 # Conflicts: # pkg/github/dependencies.go # pkg/github/dependencies_test.go
Collaborator
|
I am more than happy to move to this, but reviews are a bottleneck for us at the moment so hang tight! |
Author
|
@SamMorrowDrums no worries, appreciate the update! |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Verify the pinned go-github SDK accepts the cloud API version and test cloud, GHES, lookalike hosts, resources.core-only rate limits, submodule directory entries, and workflow dispatch responses. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use REST API version
2026-03-10for GitHub.com and GitHub Enterprise Cloud, while keeping GitHub Enterprise Server on2022-11-28. Apply the host-aware policy to stdio and per-request REST clients, scope discovery, and GitHub App installation-token requests.Why
Fixes #3037.
The pinned
go-github/v92 v92.0.0supports2026-03-10but still defaults requests to2022-11-28. It exposes a per-requestWithVersionoption, not a public client-wide default-version option; the transport keeps generated service calls consistent without changing every call site. A regression test exercises the SDK's own version guard with2026-03-10before checking the final host-specific header. GHES retains the established compatibility version because its supported API versions depend on the GHES release.What changed
assigneefrom issue and pull-request search field enums and their tool snapshots; retain pluralassignees.0663b830582af923e30fb14cb2e10dd3248baa86) without conflicts.resources.core-only rate-limit responses, cloud directory entries withtype: submodule, and workflow dispatch returning200with run details. Preserve coverage for legacy GHES directory entries and204dispatch responses.Breaking-change audit against GitHub's published 2026-03-10 changes:
assignees; the stale search field enums are corrected here.submoduleas returned; individual submodules already have explicit metadata handling. Raw file downloads use the separate raw-content service, not a versioned REST contents response. New/legacy directory shapes pass tool-output coverage.ratepayload; SDK decoding usesresources.core, and rate-limit errors use response headers. Added coverage for a response withoutrate.200JSON response; noreturn_run_detailsparameter is sent. Added coverage alongside existing204tests.merge_commit_sha,has_downloads,use_squash_pr_title_as_default, beta-media payload fields, gisthistory/forks, or legacy CVSS fields. Team creation, installation deletion, migration, attestation, removed root/hub fields, organization-secret writes and CodeQL default-setup endpoints are not used by these tools. Repository creation already reports non-success responses generically, including trade-control451. No additional production-code fixes were needed.MCP impact
Cloud REST calls opt into
2026-03-10; GHES retains2022-11-28. Issue/PR search field selection no longer advertises singularassignee.Prompts tested (tool changes only)
get_file_contentsfor cloud/GHES submodule directory entries andactions_run_triggerwithmethod=run_workflowfor the new response contract; host/version and scope/token paths are covered by mocked HTTP tests.Security / limits
Existing token host restrictions are unchanged. GitHub App token exchange uses the same host-compatible API-version policy; lookalike domains do not receive the cloud API version.
Tool renaming
deprecated_tool_aliases.goExisting tool names are unchanged.
Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lintscript/lint— passed, zero issues../script/testscript/test— passed, full race-enabled suite, including the new regression cases.Additional validation:
go test -race ./pkg/http/transport ./pkg/github ./internal/ghmcp ./internal/githubapp ./pkg/scopes ./pkg/utils -run 'TestAPIVersionTransport|TestParseHostType|TestRequestDepsGetClientPreservesGHESAPIVersion|TestCreateGitHubClientsTokenProvider|TestInstallationTokenSourceSetsAPIVersionForGitHubCloud|TestFetcher_FetchTokenScopes|TestTypedRepositoryOutputs|Test_ActionsRunTrigger_RunWorkflow' -count=1— passed.script/generate-docs— passed; generated documentation unchanged.go build ./cmd/github-mcp-server— passed.git diff --check— passed.Fork CI previously required maintainer approval. Workflows have not been approved by this update; approve and inspect the new-head checks before merging. The historical failed run on
3b62b709no longer has retrievable job logs, so its original cause could not be established; current local lint and full race validation pass.Docs
Generated documentation was regenerated and is unchanged; the compatibility policy and audit are documented above.