Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Pin REST API version to 2022-11-28#12680

Merged
williammartin merged 1 commit intotrunkcli/cli:trunkfrom
wm-add-api-versioncli/cli:wm-add-api-versionCopy head branch name to clipboard
Feb 13, 2026
Merged

Pin REST API version to 2022-11-28#12680
williammartin merged 1 commit intotrunkcli/cli:trunkfrom
wm-add-api-versioncli/cli:wm-add-api-versionCopy head branch name to clipboard

Conversation

@williammartin
Copy link
Member

@williammartin williammartin commented Feb 13, 2026

Description

Companion to cli/go-gh#213.

In cli/go-gh#213, go-gh starts including X-GitHub-Api-Version: 2022-11-28 in each API client request, unless the consumer sets SkipDefaultHeaders: true. The CLI sets this in two places, so we need to ensure both paths provide the header explicitly.

Before

➜ GH_DEBUG=api gh pr list
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2026-02-13 19:50:26.119198 +0100 CET m=+0.069410376
* Request to https://api.github.com/graphql
> POST /graphql HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████
> Content-Length: 381
> Content-Type: application/json; charset=utf-8
> Graphql-Features: merge_queue
> Time-Zone: Europe/Amsterdam
> User-Agent: GitHub CLI 2.86.0

After

➜ GH_DEBUG=api ./bin/gh pr list
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2026-02-13 19:51:04.912836 +0100 CET m=+0.075533960
* Request to https://api.github.com/graphql
> POST /graphql HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
> Authorization: token ████████████████████
> Content-Length: 381
> Content-Type: application/json; charset=utf-8
> Graphql-Features: merge_queue
> Time-Zone: Europe/Amsterdam
> User-Agent: GitHub CLI v2.86.0-88-gd1aab0393
> X-Github-Api-Version: 2022-11-28 <-------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

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 (apiVersion and apiVersionValue) to api/client.go
  • Modified both code paths that use SkipDefaultHeaders: true to 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.

Copy link
Member

@BagToad BagToad left a comment

Choose a reason for hiding this comment

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

LGTM

@williammartin williammartin merged commit 1af2823 into trunk Feb 13, 2026
18 checks passed
@williammartin williammartin deleted the wm-add-api-version branch February 13, 2026 18:55
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.