feat: add support for GHES#387
Conversation
There was a problem hiding this comment.
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/githubOctokit with an explicitbaseUrlderived from environment variables. - Update
package-lock.jsonto 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.
Set GITHUB_API_URL based on GITHUB_SERVER_URL if not defined.
|
I simplified the solution. WDYT? |
|
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 |
|
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. |
|
this won't work unfortunately, see #386 (comment) either we implement the workaround, or we need to wait for GHES to support the |
not really, you just need a |
| get isGithubEnterprise() { | ||
| return process.env.GITHUB_API_URL != 'https://api.github.com' | ||
| } |
There was a problem hiding this comment.
the only addition to the class
|
@qoomon can you review again? implemented the workaround that we discussed |
…alerno-asml/actions--context into csalerno-add-support-for-ghes
| await getCurrentJob(octokit).then((job) => { | ||
| await getCurrentJob(octokit, context).then((job) => { | ||
| if (job === undefined) { | ||
| core.warning('Current job not found for runner: ' + context.runnerName) |
There was a problem hiding this comment.
possibly raise an error? but should never happen
| 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` |
There was a problem hiding this comment.
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
Closes #386