Skip to content

Commit e080dc8

Browse files
committed
Check if file is .quality.sarif for CQ upload
1 parent 7b7f47d commit e080dc8

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

lib/upload-sarif-action.js

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

src/upload-sarif.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,22 @@ export async function uploadSarif(
8383
}
8484

8585
// If there are `.quality.sarif` files in `sarifPath`, then upload those to the code quality service.
86-
const qualityUploadResult = await findAndUpload(
87-
logger,
88-
features,
89-
sarifPath,
90-
pathStats,
91-
checkoutPath,
92-
analyses.CodeQuality,
93-
actionsUtil.fixCodeQualityCategory(logger, category),
94-
);
95-
if (qualityUploadResult !== undefined) {
96-
uploadResults[analyses.AnalysisKind.CodeQuality] = qualityUploadResult;
86+
if (
87+
pathStats.isDirectory() ||
88+
(pathStats.isFile() && analyses.CodeQuality.sarifPredicate(sarifPath))
89+
) {
90+
const qualityUploadResult = await findAndUpload(
91+
logger,
92+
features,
93+
sarifPath,
94+
pathStats,
95+
checkoutPath,
96+
analyses.CodeQuality,
97+
actionsUtil.fixCodeQualityCategory(logger, category),
98+
);
99+
if (qualityUploadResult !== undefined) {
100+
uploadResults[analyses.AnalysisKind.CodeQuality] = qualityUploadResult;
101+
}
97102
}
98103

99104
return uploadResults;

0 commit comments

Comments
 (0)