Skip to content

Commit 1858d5a

Browse files
committed
Don't fail if no source/binaries were matched
1 parent a60c434 commit 1858d5a

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

analyze.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,11 @@ async function attachInputsZip(inputGlobs, formData, tmpDir) {
7777
const zipTarget = path.join(tmpDir, "codedx-inputfiles.zip")
7878
const numFiles = await prepareInputsZip(inputGlobs, zipTarget)
7979
if (numFiles == 0) {
80-
throw new Error("No files were matched by the source/binary glob(s)")
80+
core.warning("No files were matched by the 'source-and-binaries-glob' values, skipping source/binaries ZIP attachment")
8181
} else {
8282
core.info(`Added ${numFiles} files`)
83+
formData.append('source-and-binaries.zip', fs.createReadStream(zipTarget))
8384
}
84-
85-
formData.append('source-and-binaries.zip', fs.createReadStream(zipTarget))
8685
}
8786

8887
async function attachScanFiles(scanGlobs, formData) {

dist/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ async function attachInputsZip(inputGlobs, formData, tmpDir) {
8484
const zipTarget = path.join(tmpDir, "codedx-inputfiles.zip")
8585
const numFiles = await prepareInputsZip(inputGlobs, zipTarget)
8686
if (numFiles == 0) {
87-
throw new Error("No files were matched by the source/binary glob(s)")
87+
core.warning("No files were matched by the 'source-and-binaries-glob' values, skipping source/binaries ZIP attachment")
8888
} else {
8989
core.info(`Added ${numFiles} files`)
90+
formData.append('source-and-binaries.zip', fs.createReadStream(zipTarget))
9091
}
91-
92-
formData.append('source-and-binaries.zip', fs.createReadStream(zipTarget))
9392
}
9493

9594
async function attachScanFiles(scanGlobs, formData) {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)