Skip to content

Commit

Permalink
Showing 6 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/cli.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/cli.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/upload-lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/upload-lib.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/cli.ts
@@ -40,6 +40,8 @@ function parseGithubApiUrl(inputUrl: string): string {
}
}

const logger = getCLILogger();

program
.command('upload')
.description('Uploads a SARIF file, or all SARIF files from a directory, to code scanning')
@@ -51,7 +53,6 @@ program
.requiredOption('--github-auth <auth>', 'GitHub Apps token, or of the form "username:token" if using a personal access token')
.option('--checkout-path <path>', 'Checkout path (default: current working directory)')
.action(async (cmd: UploadArgs) => {
const logger = getCLILogger();
try {
await upload_lib.upload(
cmd.sarifFile,
@@ -68,8 +69,9 @@ program
'cli',
logger);
} catch (e) {
logger.error("Upload failed");
logger.error('Upload failed');
logger.error(e);
process.exitCode = 1;
}
});

3 changes: 3 additions & 0 deletions src/upload-lib.ts
@@ -139,6 +139,9 @@ export async function upload(
logger: Logger): Promise<UploadStatusReport> {

const sarifFiles: string[] = [];
if (!fs.existsSync(sarifPath)) {
throw new Error(`Path does not exist: ${sarifPath}`);
}
if (fs.lstatSync(sarifPath).isDirectory()) {
fs.readdirSync(sarifPath)
.filter(f => f.endsWith(".sarif"))

0 comments on commit 4b56177

Please sign in to comment.