Skip to content

Commit

Permalink
Fail the upload action if uploading a folder with no SARIF files in.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gavin committed May 1, 2020
1 parent 5d2700f commit b6a0306
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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.

3 changes: 3 additions & 0 deletions src/upload-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export async function upload(input: string) {
const sarifFiles = fs.readdirSync(input)
.filter(f => f.endsWith(".sarif"))
.map(f => path.resolve(input, f));
if (sarifFiles.length === 0) {
core.setFailed("No SARIF files found to upload in \"" + input + "\".");
}
await uploadFiles(sarifFiles);
} else {
await uploadFiles([input]);
Expand Down

0 comments on commit b6a0306

Please sign in to comment.