Scanning endpoint failures should not halt the scan

This commit is contained in:
Simon Engledew 2020-11-19 15:49:46 +00:00
parent 7fda765d49
commit eb4226ede4
No known key found for this signature in database
GPG key ID: 84302E7B02FE8BCE
15 changed files with 32 additions and 49 deletions

22
lib/actions-util.js generated
View file

@ -241,7 +241,7 @@ function isHTTPError(arg) {
*
* Returns whether sending the status report was successful of not.
*/
async function sendStatusReport(statusReport, ignoreFailures = false) {
async function sendStatusReport(statusReport) {
if (util_1.isLocalRun()) {
core.debug("Not sending status report because this is a local run");
return true;
@ -271,26 +271,20 @@ async function sendStatusReport(statusReport, ignoreFailures = false) {
case 422:
// schema incompatibility when reporting status
// this means that this action version is no longer compatible with the API
// and it is possible that other endpoints have changed too
// we still want to continue as it is likely the analysis endpoint will work
if (getRequiredEnvParam("GITHUB_SERVER_URL") !== util_1.GITHUB_DOTCOM_URL) {
core.setFailed("CodeQL Action version is incompatible with the code scanning endpoint. ");
core.warning("CodeQL Action version is incompatible with the code scanning endpoint. Please update to a compatible version of codeql-action.");
}
else {
core.setFailed("CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.");
core.warning("CodeQL Action is out-of-date. Please upgrade to the latest version of codeql-action.");
}
return false;
return true;
}
}
// something else has gone wrong and the request/response will be logged by octokit
// it's possible this is a transient error and we should continue scanning if we are early in the
// process
if (ignoreFailures) {
core.warning("An unexpected error occured when sending code scanning status report.");
return true;
}
// if we are late in the process we need to halt the action and report it
core.setFailed("Failed to send code scanning status report.");
return false;
// it's possible this is a transient error and we should continue scanning
core.error("An unexpected error occured when sending code scanning status report.");
return true;
}
}
exports.sendStatusReport = sendStatusReport;