mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 22:30:44 +00:00
Move error checks out of getSarifFilePaths
This commit is contained in:
Generated
+13
-11
@@ -95568,18 +95568,10 @@ function findSarifFilesInDir(sarifPath, isSarif) {
|
||||
walkSarifFiles(sarifPath);
|
||||
return sarifFiles;
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif) {
|
||||
if (!fs18.existsSync(sarifPath)) {
|
||||
throw new ConfigurationError(`Path does not exist: ${sarifPath}`);
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif, pathStats) {
|
||||
let sarifFiles;
|
||||
if (fs18.lstatSync(sarifPath).isDirectory()) {
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
if (sarifFiles.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${sarifPath}".`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
sarifFiles = [sarifPath];
|
||||
}
|
||||
@@ -95681,10 +95673,20 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo
|
||||
return payloadObj;
|
||||
}
|
||||
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget) {
|
||||
const pathStats = fs18.lstatSync(inputSarifPath, { throwIfNoEntry: false });
|
||||
if (pathStats === void 0) {
|
||||
throw new ConfigurationError(`Path does not exist: ${inputSarifPath}`);
|
||||
}
|
||||
const sarifPaths = getSarifFilePaths(
|
||||
inputSarifPath,
|
||||
uploadTarget.sarifPredicate
|
||||
uploadTarget.sarifPredicate,
|
||||
pathStats
|
||||
);
|
||||
if (sarifPaths.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${inputSarifPath}".`
|
||||
);
|
||||
}
|
||||
return uploadSpecifiedFiles(
|
||||
sarifPaths,
|
||||
checkoutPath,
|
||||
|
||||
Generated
+13
-11
@@ -133002,18 +133002,10 @@ function findSarifFilesInDir(sarifPath, isSarif) {
|
||||
walkSarifFiles(sarifPath);
|
||||
return sarifFiles;
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif) {
|
||||
if (!fs17.existsSync(sarifPath)) {
|
||||
throw new ConfigurationError(`Path does not exist: ${sarifPath}`);
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif, pathStats) {
|
||||
let sarifFiles;
|
||||
if (fs17.lstatSync(sarifPath).isDirectory()) {
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
if (sarifFiles.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${sarifPath}".`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
sarifFiles = [sarifPath];
|
||||
}
|
||||
@@ -133115,10 +133107,20 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo
|
||||
return payloadObj;
|
||||
}
|
||||
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget) {
|
||||
const pathStats = fs17.lstatSync(inputSarifPath, { throwIfNoEntry: false });
|
||||
if (pathStats === void 0) {
|
||||
throw new ConfigurationError(`Path does not exist: ${inputSarifPath}`);
|
||||
}
|
||||
const sarifPaths = getSarifFilePaths(
|
||||
inputSarifPath,
|
||||
uploadTarget.sarifPredicate
|
||||
uploadTarget.sarifPredicate,
|
||||
pathStats
|
||||
);
|
||||
if (sarifPaths.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${inputSarifPath}".`
|
||||
);
|
||||
}
|
||||
return uploadSpecifiedFiles(
|
||||
sarifPaths,
|
||||
checkoutPath,
|
||||
|
||||
Generated
+13
-11
@@ -92374,18 +92374,10 @@ function findSarifFilesInDir(sarifPath, isSarif) {
|
||||
walkSarifFiles(sarifPath);
|
||||
return sarifFiles;
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif) {
|
||||
if (!fs13.existsSync(sarifPath)) {
|
||||
throw new ConfigurationError(`Path does not exist: ${sarifPath}`);
|
||||
}
|
||||
function getSarifFilePaths(sarifPath, isSarif, pathStats) {
|
||||
let sarifFiles;
|
||||
if (fs13.lstatSync(sarifPath).isDirectory()) {
|
||||
if (pathStats.isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
if (sarifFiles.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${sarifPath}".`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
sarifFiles = [sarifPath];
|
||||
}
|
||||
@@ -92487,10 +92479,20 @@ function buildPayload(commitOid, ref, analysisKey, analysisName, zippedSarif, wo
|
||||
return payloadObj;
|
||||
}
|
||||
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget) {
|
||||
const pathStats = fs13.lstatSync(inputSarifPath, { throwIfNoEntry: false });
|
||||
if (pathStats === void 0) {
|
||||
throw new ConfigurationError(`Path does not exist: ${inputSarifPath}`);
|
||||
}
|
||||
const sarifPaths = getSarifFilePaths(
|
||||
inputSarifPath,
|
||||
uploadTarget.sarifPredicate
|
||||
uploadTarget.sarifPredicate,
|
||||
pathStats
|
||||
);
|
||||
if (sarifPaths.length === 0) {
|
||||
throw new ConfigurationError(
|
||||
`No SARIF files found to upload in "${inputSarifPath}".`
|
||||
);
|
||||
}
|
||||
return uploadSpecifiedFiles(
|
||||
sarifPaths,
|
||||
checkoutPath,
|
||||
|
||||
Reference in New Issue
Block a user