From 53b268a8f03c26d30249868099dac82219cf3b1d Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Fri, 12 Sep 2025 12:28:03 +0200 Subject: [PATCH] Prepare for merge from main --- lib/analyze-action.js | 2 +- lib/init-action-post.js | 2 +- lib/upload-lib.js | 2 +- lib/upload-sarif-action.js | 2 +- src/upload-lib.ts | 4 +++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 0bfb66aac..d79056a20 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -95675,7 +95675,7 @@ function dumpSarifFile(sarifPayload, outputDir, logger, uploadTarget) { fs18.mkdirSync(outputDir, { recursive: true }); } else if (!fs18.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( - `The path specified by the CODEQL_ACTION_SARIF_DUMP_DIR environment variable exists and is not a directory: ${outputDir}` + `The path specified by the ${"CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */} environment variable exists and is not a directory: ${outputDir}` ); } const outputFile = path18.resolve( diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 52d67086c..f761edef2 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -133123,7 +133123,7 @@ function dumpSarifFile(sarifPayload, outputDir, logger, uploadTarget) { fs17.mkdirSync(outputDir, { recursive: true }); } else if (!fs17.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( - `The path specified by the CODEQL_ACTION_SARIF_DUMP_DIR environment variable exists and is not a directory: ${outputDir}` + `The path specified by the ${"CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */} environment variable exists and is not a directory: ${outputDir}` ); } const outputFile = path17.resolve( diff --git a/lib/upload-lib.js b/lib/upload-lib.js index d7ce92e9c..e312beccb 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -92507,7 +92507,7 @@ function dumpSarifFile(sarifPayload, outputDir, logger, uploadTarget) { fs13.mkdirSync(outputDir, { recursive: true }); } else if (!fs13.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( - `The path specified by the CODEQL_ACTION_SARIF_DUMP_DIR environment variable exists and is not a directory: ${outputDir}` + `The path specified by the ${"CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */} environment variable exists and is not a directory: ${outputDir}` ); } const outputFile = path14.resolve( diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index a6881c4c6..624b843fd 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -93207,7 +93207,7 @@ function dumpSarifFile(sarifPayload, outputDir, logger, uploadTarget) { fs14.mkdirSync(outputDir, { recursive: true }); } else if (!fs14.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( - `The path specified by the CODEQL_ACTION_SARIF_DUMP_DIR environment variable exists and is not a directory: ${outputDir}` + `The path specified by the ${"CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */} environment variable exists and is not a directory: ${outputDir}` ); } const outputFile = path15.resolve( diff --git a/src/upload-lib.ts b/src/upload-lib.ts index f1b9eb4b9..19f6cd2d0 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -750,9 +750,11 @@ async function maybeUploadSpecifiedFiles( validateUniqueCategory(sarif, uploadTarget.sentinelPrefix); logger.debug(`Serializing SARIF for upload`); const sarifPayload = JSON.stringify(sarif); + if (dumpDir) { dumpSarifFile(sarifPayload, dumpDir, logger, uploadTarget); } + if (!upload) { logger.info( `Skipping upload of ${uploadTarget.name} results because upload kind is "${uploadKind}"`, @@ -819,7 +821,7 @@ function dumpSarifFile( fs.mkdirSync(outputDir, { recursive: true }); } else if (!fs.lstatSync(outputDir).isDirectory()) { throw new ConfigurationError( - `The path specified by the CODEQL_ACTION_SARIF_DUMP_DIR environment variable exists and is not a directory: ${outputDir}`, + `The path specified by the ${EnvVar.SARIF_DUMP_DIR} environment variable exists and is not a directory: ${outputDir}`, ); } const outputFile = path.resolve(