fix: add baseUrl to Octokit constructor, if appropriate, for GHE (#52)

This attempts to fix the issue reported at
https://github.com/openai/codex-action/issues/32.

I don't have access to a GHE account, so this is hard to test, but this
looks right according to:


https://github.com/octokit/octokit.js/blob/45c56ffaa6d1799dd4ebaf83f06a8fc64fc39c49/README.md#L197-L201
This commit is contained in:
Michael Bolin
2025-11-05 14:33:32 -08:00
committed by GitHub
parent 3dafd127f5
commit 02e7b29438
2 changed files with 13 additions and 3 deletions
+6 -2
View File
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -103,7 +103,13 @@ export async function ensureActorHasWriteAccess(
};
}
const octokit = options.octokit ?? new Octokit({ auth: token });
const baseUrl = process.env.GITHUB_API_URL?.trim();
const octokit =
options.octokit ??
new Octokit({
auth: token,
...(baseUrl ? { baseUrl } : {}),
});
core.info(`Checking write access for actor '${actor}' on ${owner}/${repo}`);