Pin REST API version to 2022-11-28#12680
Merged
williammartin merged 1 commit intotrunkcli/cli:trunkfrom Feb 13, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d1aab03 to
166db75
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR pins the GitHub REST API version to 2022-11-28 by explicitly including the X-GitHub-Api-Version header in all API requests. This is necessary because the companion PR in go-gh (cli/go-gh#213) will start including this header by default, but the CLI sets SkipDefaultHeaders: true in two places, so it needs to explicitly provide the header itself.
Changes:
- Added API version constants (
apiVersionandapiVersionValue) toapi/client.go - Modified both code paths that use
SkipDefaultHeaders: trueto explicitly include the API version header - Updated all relevant tests to verify the header is present in requests
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| api/client.go | Added constants for the API version header name and value, and added the header to clientOptions() |
| api/http_client.go | Added the API version header to the headers map in NewHTTPClient() |
| api/client_test.go | Updated test expectations to include the new API version header |
| api/http_client_test.go | Updated all test cases to verify the API version header is present, including in verbose log output |
| pkg/cmd/factory/default_test.go | Added assertion to verify the API version header is present in the plain HTTP client |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Companion to cli/go-gh#213.
In cli/go-gh#213,
go-ghstarts includingX-GitHub-Api-Version: 2022-11-28in each API client request, unless the consumer setsSkipDefaultHeaders: true. The CLI sets this in two places, so we need to ensure both paths provide the header explicitly.Before
After