Pass correct baseUrl to octokit - #1288
Closed
ZauberNerd wants to merge 1 commit into
Closed
Conversation
The PR actions#1246 replaced the `getOctokit` method from the `octokit-provider.ts` file with the `getOctokit` method from the `@actions/github` package. The octokit-provider was previously responsible for creating an Octokit instance and setting the `baseUrl` via the `getServerApiUrl` helper function. This function calls `getServerUrl` which reads the server url from the `GITHUB_SERVER_URL` environment variable, which on GHES is set to the enterprise instance. This commit restores the previous behaviour by calling `getServerApiUrl` in all places where an octokit instance is created. Co-authored-by: Markus Wolf <mail@markus-wolf.de>
fhammerl
reviewed
Apr 13, 2023
| }) | ||
|
|
||
| it('getDefaultBranch should use GITHUB_SERVER_URL to set the baseUrl', async () => { | ||
| ;(github.getOctokit as jest.Mock).mockImplementation(() => { |
Contributor
There was a problem hiding this comment.
Is the ; necessary for this typecast?
The PR #1246 replaced the
getOctokitmethod from theoctokit-provider.tsfile with thegetOctokitmethod from the@actions/githubpackage.The octokit-provider was previously responsible for creating an Octokit instance and setting the
baseUrlvia thegetServerApiUrlhelper function. This function callsgetServerUrlwhich reads the server url from theGITHUB_SERVER_URLenvironment variable, which on GHES is set to the enterprise instance.This commit restores the previous behaviour by calling
getServerApiUrlin all places where an octokit instance is created.