Change order of checks in tryUploadSarifIfRunFailed

This commit is contained in:
Michael B. Gale
2026-02-24 16:39:28 +00:00
parent 0f3e632580
commit e9ce32d807
2 changed files with 36 additions and 23 deletions
+12 -11
View File
@@ -169796,23 +169796,24 @@ async function maybeUploadFailedSarif(config, repositoryNwo, features, logger) {
return uploadResult ? { ...uploadResult.statusReport, sarifID: uploadResult.sarifID } : {};
}
async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger) {
if (!isCodeScanningEnabled(config)) {
return {
upload_failed_run_skipped_because: "Code Scanning is not enabled."
};
}
if (process.env["CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY" /* ANALYZE_DID_COMPLETE_SUCCESSFULLY */] === "true") {
return {
upload_failed_run_skipped_because: "Analyze Action completed successfully"
};
}
try {
return await maybeUploadFailedSarif(
config,
repositoryNwo,
features,
logger
);
if (isCodeScanningEnabled(config)) {
return await maybeUploadFailedSarif(
config,
repositoryNwo,
features,
logger
);
} else {
return {
upload_failed_run_skipped_because: "Code Scanning is not enabled."
};
}
} catch (e) {
logger.debug(
`Failed to upload a SARIF file for this failed CodeQL code scanning run. ${e}`