Skip to content

Commit 462b0d4

Browse files
committed
Upload quality only sarif
1 parent b9b3b12 commit 462b0d4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

analyze/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ inputs:
1818
required: false
1919
# If changing this, make sure to update workflow.ts accordingly.
2020
default: "always"
21+
upload-quality-only:
22+
description: >-
23+
This is not recommended for external users since it complicates debugging. Upload the SARIF file to Code Quality only.
24+
Defaults to 'false' which uploads the generated SARIFs to both Code Scanning and Code Quality.
25+
'true' only uploads the SARIF file to Code Quality.
2126
cleanup-level:
2227
description: "Level of cleanup to perform on CodeQL databases at the end of the analyze step. This should either be 'none' to skip cleanup, or be a valid argument for the --cache-cleanup flag of the CodeQL CLI command 'codeql database cleanup' as documented at https://codeql.github.com/docs/codeql-cli/manual/database-cleanup"
2328
required: false

src/analyze-action.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -331,16 +331,21 @@ async function run() {
331331
core.setOutput("db-locations", dbLocations);
332332
core.setOutput("sarif-output", path.resolve(outputDir));
333333
const uploadInput = actionsUtil.getOptionalInput("upload");
334+
const uploadQualityOnly = actionsUtil.getOptionalInput(
335+
"upload-quality-only",
336+
);
334337
if (runStats && actionsUtil.getUploadValue(uploadInput) === "always") {
335-
uploadResult = await uploadLib.uploadFiles(
336-
outputDir,
337-
actionsUtil.getRequiredInput("checkout_path"),
338-
actionsUtil.getOptionalInput("category"),
339-
features,
340-
logger,
341-
uploadLib.CodeScanningTarget,
342-
);
343-
core.setOutput("sarif-id", uploadResult.sarifID);
338+
if (uploadQualityOnly !== "true") {
339+
uploadResult = await uploadLib.uploadFiles(
340+
outputDir,
341+
actionsUtil.getRequiredInput("checkout_path"),
342+
actionsUtil.getOptionalInput("category"),
343+
features,
344+
logger,
345+
uploadLib.CodeScanningTarget,
346+
);
347+
core.setOutput("sarif-id", uploadResult.sarifID);
348+
}
344349

345350
if (config.augmentationProperties.qualityQueriesInput !== undefined) {
346351
const qualityUploadResult = await uploadLib.uploadFiles(

0 commit comments

Comments
 (0)