Skip to content

feat: add support for GHES#387

Open
csalerno-asml wants to merge 8 commits into
qoomon:mainfrom
csalerno-asml:csalerno-add-support-for-ghes
Open

feat: add support for GHES#387
csalerno-asml wants to merge 8 commits into
qoomon:mainfrom
csalerno-asml:csalerno-add-support-for-ghes

Conversation

@csalerno-asml

Copy link
Copy Markdown

Closes #386

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to add GitHub Enterprise Server (GHES) compatibility for the action by adjusting how the Octokit client is configured.

Changes:

  • Configure @actions/github Octokit with an explicit baseUrl derived from environment variables.
  • Update package-lock.json to reflect the dependency tree/metadata after reinstall.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
index.ts Sets a custom Octokit baseUrl intended to support GHES.
package-lock.json Lockfile metadata churn (notably peer flags and some nested package entries).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread index.ts Outdated
Comment thread index.ts Outdated
Set GITHUB_API_URL based on GITHUB_SERVER_URL if not defined.
@qoomon

qoomon commented Feb 15, 2026

Copy link
Copy Markdown
Owner

I simplified the solution. WDYT?

@qoomon

qoomon commented Feb 15, 2026

Copy link
Copy Markdown
Owner

I guess we need to add a server configuration for the oidc config as well, don't we?

@csalerno-asml

Copy link
Copy Markdown
Author

I guess we need to add a server configuration for the oidc config as well, don't we?

why/how? the client needs to make REST API calls, so you just need a token to be set
also looking at the core lib, there is no mention of OIDC configs: https://github.com/search?q=repo%3Aoctokit%2Fcore.js+oidc&type=code

@qoomon

qoomon commented Feb 16, 2026

Copy link
Copy Markdown
Owner

Yes but the server of this action does call the GitHub API as well. Im not used to GHES. But I assume I need to call the GHES to create GitHub app tokens.
Anyways I'll merge the PR and you can check if it is working for you (uses: qoomon/actions--access-token@main)

@csalerno-asml

Copy link
Copy Markdown
Author

this won't work unfortunately, see #386 (comment)

either we implement the workaround, or we need to wait for GHES to support the job.check_run_id

@csalerno-asml

Copy link
Copy Markdown
Author

Yes but the server of this action does call the GitHub API as well. Im not used to GHES. But I assume I need to call the GHES to create GitHub app tokens.

not really, you just need a token as input, and that token can be either the workflow github.token or the token generated from a github app, but for the rest the usage is the same as GitHub.com

Comment thread lib/common.ts
Comment on lines +72 to +74
get isGithubEnterprise() {
return process.env.GITHUB_API_URL != 'https://api.github.com'
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

the only addition to the class

@csalerno-asml

Copy link
Copy Markdown
Author

@qoomon can you review again? implemented the workaround that we discussed

Comment thread index.ts
await getCurrentJob(octokit).then((job) => {
await getCurrentJob(octokit, context).then((job) => {
if (job === undefined) {
core.warning('Current job not found for runner: ' + context.runnerName)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

possibly raise an error? but should never happen

Comment thread index.ts
import * as github from "@actions/github";

if(!process.env.GITHUB_API_URL && process.env.GITHUB_SERVER_URL) {
process.env.GITHUB_API_URL = `${process.env.GITHUB_SERVER_URL.replace(/\/$/, '')}/api/v3`

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

not an expert of js/ts, once the process.env is modified here, will it stay up-to-date for the entire process life?
if not, the EnhancedContext::isGithubEnterprise() method impl is wrong, else is ok

@csalerno-asml
csalerno-asml requested a review from qoomon February 23, 2026 11:09
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.

Support for GitHub Enterprise

3 participants