@@ -298,11 +298,6 @@ function isHTTPError(arg: any): arg is HTTPError {
298298 return arg ?. status !== undefined && Number . isInteger ( arg . status ) ;
299299}
300300
301- function errorMessage ( message : string , notFatal : boolean ) : boolean {
302- ( notFatal ? core . warning : core . setFailed ) ( message ) ;
303- return notFatal ;
304- }
305-
306301/**
307302 * Send a status report to the code_scanning/analysis/status endpoint.
308303 *
@@ -358,21 +353,32 @@ export async function sendStatusReport<S extends StatusReportBase>(
358353 // we should not stop the scanning process
359354 // on dotcom we always want to be notified if something has gone wrong
360355 // as this is unlikely to be a transient failure
361- return errorMessage (
362- "Invalid status report sent to code scanning." ,
363- getRequiredEnvParam ( "GITHUB_SERVER_URL" ) !== GITHUB_DOTCOM_URL
364- ) ;
356+ if ( getRequiredEnvParam ( "GITHUB_SERVER_URL" ) !== GITHUB_DOTCOM_URL ) {
357+ core . setFailed (
358+ "CodeQL Action version is incompatible with the code scanning endpoint. "
359+ ) ;
360+ } else {
361+ core . setFailed (
362+ "CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action."
363+ ) ;
364+ }
365+
366+ return false ;
365367 }
366368 }
367369
368370 // something else has gone wrong and the request/response will be logged by octokit
369371 // it's possible this is a transient error and we should continue scanning if we are early in the
370372 // process
373+ if ( ignoreFailures ) {
374+ core . warning (
375+ "An unexpected error occured when sending code scanning status report."
376+ ) ;
377+ return true ;
378+ }
371379 // if we are late in the process we need to halt the action and report it
372- return errorMessage (
373- "Unexpected error when sending code scanning status report." ,
374- ignoreFailures
375- ) ;
380+ core . setFailed ( "Failed to send code scanning status report." ) ;
381+ return false ;
376382 }
377383}
378384
0 commit comments