Skip to content

fix: pass X-GitHub-Api-Version as top-level header in dispatchWorkflow#33419

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-warning-in-run
May 20, 2026
Merged

fix: pass X-GitHub-Api-Version as top-level header in dispatchWorkflow#33419
pelikhan merged 2 commits into
mainfrom
copilot/fix-warning-in-run

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

dispatchWorkflow was nesting the API version header under request.headers, which @octokit/request carries through the params object but never applies to the actual HTTP request — only top-level headers are sent over the wire. This caused the deprecation warning in the "Route slash command" CI step.

Changes

  • route_slash_command.cjs — move X-GitHub-Api-Version from request: { headers: {...} } to top-level headers: {...} in createWorkflowDispatch call
  • route_slash_command.test.cjs — assert headers["X-GitHub-Api-Version"] instead of request.headers["X-GitHub-Api-Version"]
// before
await github.rest.actions.createWorkflowDispatch({
  ...,
  request: { headers: { "X-GitHub-Api-Version": GITHUB_API_VERSION } },
});

// after
await github.rest.actions.createWorkflowDispatch({
  ...,
  headers: { "X-GitHub-Api-Version": GITHUB_API_VERSION },
});

…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 AI requested a review from pelikhan May 20, 2026 01:02
@pelikhan pelikhan marked this pull request as ready for review May 20, 2026 01:03
Copilot AI review requested due to automatic review settings May 20, 2026 01:03
Copy link
Copy Markdown
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

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-Version to the top-level headers option in github.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

@pelikhan pelikhan merged commit 387adf6 into main May 20, 2026
11 of 12 checks passed
@pelikhan pelikhan deleted the copilot/fix-warning-in-run branch May 20, 2026 01:07
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.

3 participants