Skip to content

feat: support custom GitHub API base URL#387

Merged
LouisBrunner merged 1 commit intoLouisBrunner:mainfrom
Unity-Technologies:support-ghe
Apr 2, 2026
Merged

feat: support custom GitHub API base URL#387
LouisBrunner merged 1 commit intoLouisBrunner:mainfrom
Unity-Technologies:support-ghe

Conversation

@diogokiss
Copy link
Copy Markdown
Contributor

GitHub Enterprise Server deployments require routing API calls to a custom endpoint instead of the default GitHub.com API.

This commit adds a new 'github_api_url' action input and passes it to Octokit as baseUrl so check run calls target the configured GitHub API host. Additionally, it documents the input in README and adds a test case that validates requests using /api/v3 when a custom API URL is provided.

Copy link
Copy Markdown
Owner

@LouisBrunner LouisBrunner left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution, this is great. 😄

LGTM apart from a few minor changes.

GitHub Enterprise Server deployments require routing API calls to a custom
endpoint instead of the default GitHub.com API.

This commit adds a new 'github_api_url' action input and passes it to Octokit as
baseUrl so check run calls target the configured GitHub API host. Additionally,
it documents the input in README and adds a test case that validates requests
using /api/v3 when a custom API URL is provided.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

@diogokiss
Copy link
Copy Markdown
Contributor Author

Hey, @LouisBrunner ! Thank you for your review. I've addressed both of your suggestions/comments. The Pull Request is ready for another pass. 🤞🏼

@diogokiss diogokiss requested a review from LouisBrunner April 1, 2026 22:08
@LouisBrunner LouisBrunner merged commit 21db08c into LouisBrunner:main Apr 2, 2026
3 checks passed
@LouisBrunner
Copy link
Copy Markdown
Owner

🌟 Stellar! Thanks a lot for your contribution!!

@diogokiss
Copy link
Copy Markdown
Contributor Author

🌟 Stellar! Thanks a lot for your contribution!!

Thank you for supporting open source software. 🫂

@diogokiss diogokiss deleted the support-ghe branch April 2, 2026 10:50
@frederikb
Copy link
Copy Markdown

@diogokiss did you test the latest version of action beforehand on GHES without your change? Because we've been using it for years on GHES without any problems.

const octokit = github.getOctokit(inputs.token, {

The docs on the actions.getOctokit state the following:

Returns an authenticated Octokit client that follows the machine proxy settings and correctly sets GHES base urls

Source: https://github.com/actions/toolkit/blob/main/packages/github/README.md

which can be confirmed by verifying the implementation:

https://github.com/actions/toolkit/blob/b68d046fe39bcaf86bb49660cb3f307c35d6efb9/packages/github/src/internal/utils.ts#L42-L44

which uses the environment variable GITHUB_API_URL which in turn is documented as follows in the GHES docs:

Returns the API URL. For example: http(s)://HOSTNAME/api/v3.

Source: https://docs.github.com/en/enterprise-server@3.20/actions/reference/workflows-and-actions/variables#:~:text=the%20actor%20username.-,GITHUB_API_URL,-Returns%20the%20API

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