Skip to content

Pass correct baseUrl to octokit - #1288

Closed
ZauberNerd wants to merge 1 commit into
actions:mainfrom
ZauberNerd:fix-ghes-server-url
Closed

Pass correct baseUrl to octokit#1288
ZauberNerd wants to merge 1 commit into
actions:mainfrom
ZauberNerd:fix-ghes-server-url

Conversation

@ZauberNerd

Copy link
Copy Markdown

The PR #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.

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>
})

it('getDefaultBranch should use GITHUB_SERVER_URL to set the baseUrl', async () => {
;(github.getOctokit as jest.Mock).mockImplementation(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the ; necessary for this typecast?