Push unsuccessful execution API error detection into upload library

This commit is contained in:
Henry Mercer 2022-11-29 16:25:29 +00:00
parent 7fc3c603aa
commit e628ee0ae1
6 changed files with 53 additions and 32 deletions

View file

@ -54,18 +54,8 @@ async function uploadFailedSarif(config, repositoryNwo, featureEnablement, logge
await codeql.diagnosticsExport(sarifFile, category);
core.info(`Uploading failed SARIF file ${sarifFile}`);
const uploadResult = await uploadLib.uploadFromActions(sarifFile, checkoutPath, category, logger);
if (uploadResult !== undefined && waitForProcessing) {
try {
await uploadLib.waitForProcessing(repositoryNwo, uploadResult.sarifID, logger);
}
catch (e) {
if (e instanceof Error && e.message.includes("unsuccessful execution")) {
logger.info("Submitting a SARIF file for the failed run isn't yet supported, continuing.");
}
else {
throw e;
}
}
if (waitForProcessing) {
await uploadLib.waitForProcessing(repositoryNwo, uploadResult.sarifID, logger, { isUnsuccessfulExecution: true });
}
}
async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, printDebugLogs, repositoryNwo, featureEnablement, logger) {