fix: pass X-GitHub-Api-Version as top-level header in dispatchWorkflow#33419
Merged
Conversation
…kflow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Fix octokit API version deprecation warning in dispatchWorkflow
fix: pass X-GitHub-Api-Version as top-level header in dispatchWorkflow
May 20, 2026
Copilot created this pull request from a session on behalf of
pelikhan
May 20, 2026 01:02
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes workflow dispatch requests so the X-GitHub-Api-Version header is sent as an actual HTTP header (top-level headers) rather than being nested under request.headers, which was not applied by the underlying request layer—eliminating the REST API deprecation warning seen in CI.
Changes:
- Move
X-GitHub-Api-Versionto the top-levelheadersoption ingithub.rest.actions.createWorkflowDispatch. - Update the unit test to assert against
params.headers["X-GitHub-Api-Version"].
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/route_slash_command.cjs | Sends X-GitHub-Api-Version via top-level headers in createWorkflowDispatch so it is applied to the HTTP request. |
| actions/setup/js/route_slash_command.test.cjs | Updates the assertion to match the corrected parameter shape (headers instead of request.headers). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
dispatchWorkflowwas nesting the API version header underrequest.headers, which@octokit/requestcarries through the params object but never applies to the actual HTTP request — only top-levelheadersare sent over the wire. This caused the deprecation warning in the "Route slash command" CI step.Changes
route_slash_command.cjs— moveX-GitHub-Api-Versionfromrequest: { headers: {...} }to top-levelheaders: {...}increateWorkflowDispatchcallroute_slash_command.test.cjs— assertheaders["X-GitHub-Api-Version"]instead ofrequest.headers["X-GitHub-Api-Version"]