mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 14:20:19 +00:00
Use getSarifFilePaths in upload-sarif
This commit is contained in:
Generated
+14
-11
@@ -93075,6 +93075,15 @@ function findSarifFilesInDir(sarifPath, isSarif) {
|
||||
walkSarifFiles(sarifPath);
|
||||
return sarifFiles;
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif, pathStats) {
|
||||
let sarifFiles;
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
} else {
|
||||
sarifFiles = [sarifPath];
|
||||
}
|
||||
return sarifFiles;
|
||||
}
|
||||
function countResultsInSarif(sarif) {
|
||||
let numResults = 0;
|
||||
const parsedSarif = JSON.parse(sarif);
|
||||
@@ -93418,17 +93427,11 @@ function filterAlertsByDiffRange(logger, sarif) {
|
||||
|
||||
// src/upload-sarif.ts
|
||||
async function findAndUpload(logger, features, sarifPath, pathStats, checkoutPath, analysis, category) {
|
||||
let sarifFiles;
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(
|
||||
sarifPath,
|
||||
analysis.sarifPredicate
|
||||
);
|
||||
} else if (pathStats.isFile() && analysis.sarifPredicate(sarifPath)) {
|
||||
sarifFiles = [sarifPath];
|
||||
} else {
|
||||
return void 0;
|
||||
}
|
||||
const sarifFiles = getSarifFilePaths(
|
||||
sarifPath,
|
||||
analysis.sarifPredicate,
|
||||
pathStats
|
||||
);
|
||||
if (sarifFiles.length !== 0) {
|
||||
return await uploadSpecifiedFiles(
|
||||
sarifFiles,
|
||||
|
||||
+5
-12
@@ -27,18 +27,11 @@ export async function findAndUpload(
|
||||
analysis: analyses.AnalysisConfig,
|
||||
category?: string,
|
||||
): Promise<upload_lib.UploadResult | undefined> {
|
||||
let sarifFiles: string[] | undefined;
|
||||
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = upload_lib.findSarifFilesInDir(
|
||||
sarifPath,
|
||||
analysis.sarifPredicate,
|
||||
);
|
||||
} else if (pathStats.isFile() && analysis.sarifPredicate(sarifPath)) {
|
||||
sarifFiles = [sarifPath];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
const sarifFiles: string[] | undefined = upload_lib.getSarifFilePaths(
|
||||
sarifPath,
|
||||
analysis.sarifPredicate,
|
||||
pathStats,
|
||||
);
|
||||
|
||||
if (sarifFiles.length !== 0) {
|
||||
return await upload_lib.uploadSpecifiedFiles(
|
||||
|
||||
Reference in New Issue
Block a user