Create fix for Add GitHub Enterprise Server support #42

This commit is contained in:
Justin Hutchings
2024-08-26 21:24:18 +00:00
parent 7303e5e522
commit 8511b070f0
2 changed files with 11 additions and 2 deletions
+7 -2
View File
@@ -140,8 +140,13 @@ export default class ComponentDetection {
}
private static async getLatestReleaseURL(): Promise<string> {
const githubToken = core.getInput('token') || process.env.GITHUB_TOKEN || "";
const octokit = github.getOctokit(githubToken);
var githubToken = core.getInput('token') || process.env.GITHUB_TOKEN || "";
// If the releaseServerUrl is github.com and Actions environment is GHES, then use an empty string as the token
if (core.getInput('releaseServerUrl') != github.context.apiUrl) {
githubToken = "";
}
const octokit = github.getOctokit(githubToken, { baseUrl: core.getInput('releaseServerUrl') });
const owner = "microsoft";
const repo = "component-detection";