Merge pull request #3233 from github/mbg/getOptionalEnvVar

Add `getOptionalEnvVar` helper
This commit is contained in:
Michael B. Gale
2025-10-24 16:55:48 +01:00
committed by GitHub
6 changed files with 69 additions and 8 deletions
+2 -2
View File
@@ -747,10 +747,10 @@ export async function writePostProcessedFiles(
postProcessingResults: PostProcessingResults,
) {
// If there's an explicit input, use that. Otherwise, use the value from the environment variable.
const outputPath = pathInput || process.env[EnvVar.SARIF_DUMP_DIR];
const outputPath = pathInput || util.getOptionalEnvVar(EnvVar.SARIF_DUMP_DIR);
// If we have a non-empty output path, write the SARIF file to it.
if (outputPath !== undefined && outputPath.trim() !== "") {
if (outputPath !== undefined) {
dumpSarifFile(
JSON.stringify(postProcessingResults.sarif),
outputPath,