From 3b2ec7c241aa602f9a87f5a0bf6c78f73d41d08d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 09:52:14 +0000 Subject: [PATCH 1/2] fix: add X-GitHub-Api-Version header to suppress REST API deprecation warning Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f1268047-60d8-4f92-a744-5bc51a32a05d Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/setup_globals.cjs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/actions/setup/js/setup_globals.cjs b/actions/setup/js/setup_globals.cjs index faeca9534fb..e155d021bc8 100644 --- a/actions/setup/js/setup_globals.cjs +++ b/actions/setup/js/setup_globals.cjs @@ -26,6 +26,14 @@ const { createRateLimitAwareGithub } = require("./github_rate_limit_logger.cjs") */ function setupGlobals(coreModule, githubModule, contextModule, execModule, ioModule, getOctokitFn) { global.core = coreModule; + // Inject X-GitHub-Api-Version header on every request to suppress the + // "@octokit/request: endpoint is deprecated" warning that fires when the + // unversioned GitHub REST API is used. + githubModule.hook.before("request", options => { + if (!options.headers["X-GitHub-Api-Version"]) { + options.headers["X-GitHub-Api-Version"] = "2022-11-28"; + } + }); // @ts-expect-error - Assigning to global properties that are declared as const // Wrap the github object so every github.rest.*.*() call automatically logs // x-ratelimit-* headers to github_rate_limits.jsonl for observability. @@ -35,7 +43,17 @@ function setupGlobals(coreModule, githubModule, contextModule, execModule, ioMod global.exec = execModule; // @ts-expect-error - Assigning to global properties that are declared as const global.io = ioModule; - global.getOctokit = getOctokitFn; + // Wrap getOctokit so every client created via global.getOctokit(token) also + // carries X-GitHub-Api-Version, suppressing the deprecation warning for + // per-handler authenticated clients (cross-repo PAT operations, etc.). + global.getOctokit = (token, options = {}) => + getOctokitFn(token, { + ...options, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + ...(options.headers || {}), + }, + }); } module.exports = { setupGlobals }; From cbdec3cce2b19e2d8fe47b601c6cedaea748f588 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 10:59:22 +0000 Subject: [PATCH 2/2] Add changeset --- .changeset/patch-github-api-version-header.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/patch-github-api-version-header.md diff --git a/.changeset/patch-github-api-version-header.md b/.changeset/patch-github-api-version-header.md new file mode 100644 index 00000000000..b56bf6eb912 --- /dev/null +++ b/.changeset/patch-github-api-version-header.md @@ -0,0 +1,5 @@ +--- +"gh-aw": patch +--- + +Suppress GitHub REST API deprecation warnings by adding the required API version header to safe-output GitHub clients.