Skip to content

Commit

Permalink
Create fix for Add GitHub Enterprise Server support #42
Browse files Browse the repository at this point in the history
  • Loading branch information
jhutchings1 committed Aug 26, 2024
1 parent 7303e5e commit 8511b07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
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.'
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:
using: 'node16'
main: 'dist/index.js'
Expand Down
9 changes: 7 additions & 2 deletions componentDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

0 comments on commit 8511b07

Please sign in to comment.