Create fix for Add GitHub Enterprise Server support #42
This commit is contained in:
@@ -21,6 +21,10 @@ inputs:
|
|||||||
detectorsFilter:
|
detectorsFilter:
|
||||||
description: 'A comma separated list with the identifiers of the specific detectors to be used. This is meant to be used for testing purposes only.'
|
description: 'A comma separated list with the identifiers of the specific detectors to be used. This is meant to be used for testing purposes only.'
|
||||||
required: false
|
required: false
|
||||||
|
releaseServerUrl:
|
||||||
|
description: 'The baseUrl of the release server to use. By default, this is github.com/api/v3, but it can be set to your GitHub Enterprise Server instead.'
|
||||||
|
required: false
|
||||||
|
default: 'https://github.com/api/v3'
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
@@ -140,8 +140,13 @@ export default class ComponentDetection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static async getLatestReleaseURL(): Promise<string> {
|
private static async getLatestReleaseURL(): Promise<string> {
|
||||||
const githubToken = core.getInput('token') || process.env.GITHUB_TOKEN || "";
|
var githubToken = core.getInput('token') || process.env.GITHUB_TOKEN || "";
|
||||||
const octokit = github.getOctokit(githubToken);
|
|
||||||
|
// 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 owner = "microsoft";
|
||||||
const repo = "component-detection";
|
const repo = "component-detection";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user