Fail the upload action if uploading a folder with no SARIF files in.

This commit is contained in:
Chris Gavin 2020-05-01 11:12:15 +01:00
parent 5d2700f9cb
commit b6a0306228
No known key found for this signature in database
GPG key ID: 07F950B80C27E4DA
2 changed files with 6 additions and 0 deletions

3
lib/upload-lib.js generated
View file

@ -61,6 +61,9 @@ async function upload(input) {
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 {

View file

@ -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]);