Handle API versions that reject unsuccessful executions

This commit is contained in:
Henry Mercer 2022-11-25 16:45:37 +00:00
parent 122b180b66
commit 37b4358e44
3 changed files with 27 additions and 7 deletions

View file

@ -55,7 +55,17 @@ async function uploadFailedSarif(config, repositoryNwo, featureEnablement, logge
core.info(`Uploading failed SARIF file ${sarifFile}`);
const uploadResult = await uploadLib.uploadFromActions(sarifFile, checkoutPath, category, logger);
if (uploadResult !== undefined && waitForProcessing) {
await uploadLib.waitForProcessing(repositoryNwo, uploadResult.sarifID, logger);
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;
}
}
}
}
async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, printDebugLogs, repositoryNwo, featureEnablement, logger) {