@@ -141,14 +141,16 @@ export default class ComponentDetection {
141141 }
142142
143143 private static async getLatestReleaseURL ( ) : Promise < string > {
144- var githubToken = core . getInput ( 'token' ) || process . env . GITHUB_TOKEN || "" ;
144+ let githubToken = core . getInput ( 'token' ) || process . env . GITHUB_TOKEN || "" ;
145145
146- // If the releaseServerUrl is set, then use an empty string as the token
147- if ( core . getInput ( 'releaseServerUrl' ) != null ) {
146+ const githubAPIURL = 'https://api.github.com'
147+
148+ let ghesMode = github . context . apiUrl != githubAPIURL ;
149+ // If the we're running in GHES, then use an empty string as the token
150+ if ( ghesMode ) {
148151 githubToken = "" ;
149152 }
150- const serverUrl = core . getInput ( 'releaseServerUrl' ) || github . context . apiUrl ;
151- const octokit = new Octokit ( { auth : githubToken , baseUrl : serverUrl , request : { fetch : fetch } , log : {
153+ const octokit = new Octokit ( { auth : githubToken , baseUrl : githubAPIURL , request : { fetch : fetch } , log : {
152154 debug : core . debug ,
153155 info : core . info ,
154156 warn : core . warning ,
@@ -157,7 +159,7 @@ export default class ComponentDetection {
157159
158160 const owner = "microsoft" ;
159161 const repo = "component-detection" ;
160- core . debug ( "Attempting to download latest release from " + serverUrl ) ;
162+ core . debug ( "Attempting to download latest release from " + githubAPIURL ) ;
161163
162164 try {
163165 const latestRelease = await octokit . request ( "GET /repos/{owner}/{repo}/releases/latest" , { owner, repo} ) ;
0 commit comments