File tree Expand file tree Collapse file tree 2 files changed +34
-23
lines changed
Expand file tree Collapse file tree 2 files changed +34
-23
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ interface UploadSarifStatusReport
3838 *
3939 * @param logger The logger to use.
4040 * @param features Information about FFs.
41- * @param sarifPath The path to a directory containing SARIF files.
41+ * @param sarifPath The path to a SARIF file or directory containing SARIF files.
4242 * @param pathStats Information about `sarifPath`.
4343 * @param checkoutPath The checkout path.
4444 * @param analysis The configuration of the analysis we should upload SARIF files for.
@@ -54,22 +54,28 @@ async function findAndUpload(
5454 analysis : analyses . AnalysisConfig ,
5555 category ?: string ,
5656) : Promise < upload_lib . UploadResult | undefined > {
57+ let sarifFiles : string [ ] | undefined ;
58+
5759 if ( pathStats . isDirectory ( ) ) {
58- const sarifFiles = upload_lib . findSarifFilesInDir (
60+ sarifFiles = upload_lib . findSarifFilesInDir (
5961 sarifPath ,
6062 analysis . sarifPredicate ,
6163 ) ;
64+ } else if ( pathStats . isFile ( ) && analysis . sarifPredicate ( sarifPath ) ) {
65+ sarifFiles = [ sarifPath ] ;
66+ } else {
67+ return undefined ;
68+ }
6269
63- if ( sarifFiles . length !== 0 ) {
64- return await upload_lib . uploadSpecifiedFiles (
65- sarifFiles ,
66- checkoutPath ,
67- category ,
68- features ,
69- logger ,
70- analysis ,
71- ) ;
72- }
70+ if ( sarifFiles . length !== 0 ) {
71+ return await upload_lib . uploadSpecifiedFiles (
72+ sarifFiles ,
73+ checkoutPath ,
74+ category ,
75+ features ,
76+ logger ,
77+ analysis ,
78+ ) ;
7379 }
7480
7581 return undefined ;
You can’t perform that action at this time.
0 commit comments