Skip to content

Commit dfdd633

Browse files
committed
Fix upload-sarif not uploading non-.sarif files
1 parent 6592567 commit dfdd633

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/upload-sarif-action.js

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

src/upload-sarif-action.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async function findAndUpload(
5252
pathStats: fs.Stats,
5353
checkoutPath: string,
5454
analysis: analyses.AnalysisConfig,
55+
sarifPredicate: (name: string) => boolean,
5556
category?: string,
5657
): Promise<upload_lib.UploadResult | undefined> {
5758
let sarifFiles: string[] | undefined;
@@ -61,7 +62,7 @@ async function findAndUpload(
6162
sarifPath,
6263
analysis.sarifPredicate,
6364
);
64-
} else if (pathStats.isFile() && analysis.sarifPredicate(sarifPath)) {
65+
} else if (pathStats.isFile() && sarifPredicate(sarifPath)) {
6566
sarifFiles = [sarifPath];
6667
} else {
6768
return undefined;
@@ -153,6 +154,8 @@ async function run() {
153154
pathStats,
154155
checkoutPath,
155156
analyses.CodeScanning,
157+
// Upload anything to Code Scanning that is not intended for Code Quality.
158+
(name) => !analyses.CodeQuality.sarifPredicate(name),
156159
category,
157160
);
158161
if (uploadResult !== undefined) {
@@ -171,6 +174,7 @@ async function run() {
171174
pathStats,
172175
checkoutPath,
173176
analyses.CodeQuality,
177+
analyses.CodeQuality.sarifPredicate,
174178
actionsUtil.fixCodeQualityCategory(logger, category),
175179
);
176180
if (qualityUploadResult !== undefined) {

0 commit comments

Comments
 (0)