Skip to content

Commit b7c814c

Browse files
committed
Gate uploadSarif behind FF, use old implementation otherwise
1 parent f88cb01 commit b7c814c

File tree

2 files changed

+103
-15
lines changed

2 files changed

+103
-15
lines changed

lib/analyze-action.js

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

src/analyze-action.ts

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ import { getApiDetails, getGitHubVersion } from "./api-client";
1919
import { runAutobuild } from "./autobuild";
2020
import { getTotalCacheSize, shouldStoreCache } from "./caching-utils";
2121
import { getCodeQL } from "./codeql";
22-
import { Config, getConfig } from "./config-utils";
22+
import {
23+
Config,
24+
getConfig,
25+
isCodeQualityEnabled,
26+
isCodeScanningEnabled,
27+
} from "./config-utils";
2328
import { uploadDatabases } from "./database-upload";
2429
import {
2530
DependencyCacheUploadStatusReport,
@@ -344,13 +349,41 @@ async function run() {
344349
const checkoutPath = actionsUtil.getRequiredInput("checkout_path");
345350
const category = actionsUtil.getOptionalInput("category");
346351

347-
uploadResults = await uploadSarif(
348-
logger,
349-
features,
350-
checkoutPath,
351-
outputDir,
352-
category,
353-
);
352+
if (await features.getValue(Feature.AnalyzeUseNewUpload)) {
353+
uploadResults = await uploadSarif(
354+
logger,
355+
features,
356+
checkoutPath,
357+
outputDir,
358+
category,
359+
);
360+
} else {
361+
uploadResults = {};
362+
363+
if (isCodeScanningEnabled(config)) {
364+
uploadResults[analyses.AnalysisKind.CodeScanning] =
365+
await uploadLib.uploadFiles(
366+
outputDir,
367+
actionsUtil.getRequiredInput("checkout_path"),
368+
actionsUtil.getOptionalInput("category"),
369+
features,
370+
logger,
371+
analyses.CodeScanning,
372+
);
373+
}
374+
375+
if (isCodeQualityEnabled(config)) {
376+
uploadResults[analyses.AnalysisKind.CodeQuality] =
377+
await uploadLib.uploadFiles(
378+
outputDir,
379+
actionsUtil.getRequiredInput("checkout_path"),
380+
actionsUtil.getOptionalInput("category"),
381+
features,
382+
logger,
383+
analyses.CodeQuality,
384+
);
385+
}
386+
}
354387

355388
core.setOutput(
356389
"sarif-id",

0 commit comments

Comments
 (0)