Extract filepath retrieval to a method
This commit is contained in:
parent
378f1f95d7
commit
7ae9b0db35
1 changed files with 18 additions and 15 deletions
|
|
@ -97,6 +97,23 @@ export async function upload(
|
|||
mode: util.Mode,
|
||||
logger: Logger
|
||||
): Promise<UploadStatusReport> {
|
||||
return await uploadFiles(
|
||||
getSarifFilePaths(sarifPath),
|
||||
repositoryNwo,
|
||||
commitOid,
|
||||
ref,
|
||||
analysisKey,
|
||||
analysisName,
|
||||
workflowRunID,
|
||||
checkoutPath,
|
||||
environment,
|
||||
apiDetails,
|
||||
mode,
|
||||
logger
|
||||
);
|
||||
}
|
||||
|
||||
function getSarifFilePaths(sarifPath: string) {
|
||||
const sarifFiles: string[] = [];
|
||||
if (!fs.existsSync(sarifPath)) {
|
||||
throw new Error(`Path does not exist: ${sarifPath}`);
|
||||
|
|
@ -115,21 +132,7 @@ export async function upload(
|
|||
} else {
|
||||
sarifFiles.push(sarifPath);
|
||||
}
|
||||
|
||||
return await uploadFiles(
|
||||
sarifFiles,
|
||||
repositoryNwo,
|
||||
commitOid,
|
||||
ref,
|
||||
analysisKey,
|
||||
analysisName,
|
||||
workflowRunID,
|
||||
checkoutPath,
|
||||
environment,
|
||||
apiDetails,
|
||||
mode,
|
||||
logger
|
||||
);
|
||||
return sarifFiles;
|
||||
}
|
||||
|
||||
// Counts the number of results in the given SARIF file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue