codeql-action icon indicating copy to clipboard operation
codeql-action copied to clipboard

Do not crash with empty folder

Open prabhu opened this issue 5 years ago • 1 comments

Scan uses upload-sarif step with a directory called reports. If this directory happens to be empty (no results produced), then the upload step is failing as below:

Error: No SARIF files found to upload in "reports".
Error: No SARIF files found to upload in "reports".
    at Object.upload (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-lib.js:82:19)
    at run (/home/runner/work/_actions/github/codeql-action/v1/lib/upload-sarif-action.js:29:46)

This is breaking quite a large number of builds. Is it possible to detect empty directories and prevent this step from failing with error? It is going to take some effort to make scan produce empty sarif file for various cases so would appreciate this workaround from you.

prabhu avatar Oct 29 '20 22:10 prabhu

This is an old issue. I'm just doing some backlog pruning. The proper behaviour is for the code scanning tool to produce a sarif file with no results. There needs to be a file uploaded to code scanning in order for the code scanning back end to know there has been a scan performed and no results were found.

aeisenberg avatar Jan 13 '25 21:01 aeisenberg