diff --git a/lib/entry-points.js b/lib/entry-points.js index 28d1694c1..ea4f7c9be 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -180478,6 +180478,12 @@ async function waitForProcessing(repositoryNwo, sarifID, logger2, options = { }) { logger2.startGroup("Waiting for processing to finish"); try { + if (shouldSkipSarifUpload()) { + logger2.info( + "Nothing to wait for, because SARIF upload is disabled by an environment variable and the SARIF was saved to disk." + ); + return; + } const client = getApiClient(); let statusCheckBackoff = STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS; if (process.env["NODE_ENV"] !== "test") { diff --git a/src/upload-lib.ts b/src/upload-lib.ts index 7c6f2afea..7b0a17b30 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -866,6 +866,16 @@ export async function waitForProcessing( ): Promise { logger.startGroup("Waiting for processing to finish"); try { + // If SARIF uplaod is disabled and we reach this point, then the file was written to disk and + // there is nothing to wait for. We still allow ourselves to get to this point so that we can + // see in the log that we would have waited for processing to finish if the upload had happened. + if (util.shouldSkipSarifUpload()) { + logger.info( + "Nothing to wait for, because SARIF upload is disabled by an environment variable and the SARIF was saved to disk.", + ); + return; + } + const client = api.getApiClient(); // Do an initial wait because processing will always take a minimum of 2-3 seconds