Skip to content

Commit 33a31c1

Browse files
committed
Do not prettify dumped SARIF file
1 parent a7fb336 commit 33a31c1

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

lib/analyze-action.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-lib.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-sarif-action.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload-lib.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,17 +748,17 @@ async function maybeUploadSpecifiedFiles(
748748

749749
logger.debug(`Validating that each SARIF run has a unique category`);
750750
validateUniqueCategory(sarif, uploadTarget.sentinelPrefix);
751+
logger.debug(`Serializing SARIF for upload`);
752+
const sarifPayload = JSON.stringify(sarif);
751753
if (dumpDir) {
752-
dumpSarifFile(sarif, dumpDir, logger, uploadTarget);
754+
dumpSarifFile(sarifPayload, dumpDir, logger, uploadTarget);
753755
}
754756
if (!upload) {
755757
logger.info(
756758
`Skipping upload of ${uploadTarget.name} results because upload kind is "${uploadKind}"`,
757759
);
758760
return undefined;
759761
}
760-
logger.debug(`Serializing SARIF for upload`);
761-
const sarifPayload = JSON.stringify(sarif);
762762
logger.debug(`Compressing serialized SARIF`);
763763
const zippedSarif = zlib.gzipSync(sarifPayload).toString("base64");
764764
const checkoutURI = url.pathToFileURL(checkoutPath).href;
@@ -810,7 +810,7 @@ async function maybeUploadSpecifiedFiles(
810810
* Dumps the given processed SARIF file contents to `outputDir`.
811811
*/
812812
function dumpSarifFile(
813-
sarif: SarifFile,
813+
sarifPayload: string,
814814
outputDir: string,
815815
logger: Logger,
816816
uploadTarget: analyses.AnalysisConfig,
@@ -827,7 +827,7 @@ function dumpSarifFile(
827827
`upload${uploadTarget.sarifExtension}`,
828828
);
829829
logger.info(`Dumping processed SARIF file to ${outputFile}`);
830-
fs.writeFileSync(outputFile, JSON.stringify(sarif, null, 2));
830+
fs.writeFileSync(outputFile, sarifPayload);
831831
}
832832

833833
const STATUS_CHECK_FREQUENCY_MILLISECONDS = 5 * 1000;

0 commit comments

Comments
 (0)