Skip to content

Commit

Permalink
Extract filepath retrieval to a method
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Partington committed Nov 26, 2020
1 parent 378f1f9 commit 7ae9b0d
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/upload-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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
Expand Down

0 comments on commit 7ae9b0d

Please sign in to comment.