Upgrade to GitHub REST API version 2026-03-10#688
Merged
Conversation
Adds X-GitHub-Api-Version: 2022-11-28 header to all Octokit instances via a shared makeOctokit() helper.
Contributor
There was a problem hiding this comment.
Pull request overview
Pins the GitHub REST API version used by this app’s Octokit client to address a deprecation warning from @octokit/request by ensuring a fixed X-GitHub-Api-Version header is sent.
Changes:
- Added a shared
makeOctokit()helper to centralize Octokit construction. - Updated all Octokit call sites in
GitHubClientto use the helper so the API version header is applied consistently.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| private makeOctokit(auth: string): Octokit { | ||
| return new Octokit({ auth, headers: { "X-GitHub-Api-Version": "2022-11-28" } }) |
There was a problem hiding this comment.
Octokit’s constructor options typically expect default headers under request: { headers: ... } (not a top-level headers field). If headers is ignored here, the X-GitHub-Api-Version won’t be sent and the deprecation warning will persist. Please move the API version header into the request defaults (and/or verify via a quick request trace that the header is actually present on REST calls).
Suggested change
| return new Octokit({ auth, headers: { "X-GitHub-Api-Version": "2022-11-28" } }) | |
| return new Octokit({ | |
| auth, | |
| request: { | |
| headers: { "X-GitHub-Api-Version": "2022-11-28" } | |
| } | |
| }) |
simonbs
previously approved these changes
Apr 28, 2026
Move X-GitHub-Api-Version into request.headers where Octokit actually reads default headers, not the ignored top-level headers field.
Octokit 5.0.5 does not propagate constructor-level headers to requests. The only reliable way to set the API version is on each REST call directly.
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
Fixes the following deprecation warning from
@octokit/request:Passes
X-GitHub-Api-Version: 2026-03-10on each REST call via a sharedGITHUB_API_VERSIONconstant. Constructor-level headers are not propagated by Octokit 5.0.5, so the header must be set per request.