@@ -18,6 +18,7 @@ import {
1818 isThirdPartyAnalysis ,
1919} from "./status-report" ;
2020import * as upload_lib from "./upload-lib" ;
21+ import { findAndUpload } from "./upload-sarif" ;
2122import {
2223 ConfigurationError ,
2324 checkActionVersion ,
@@ -32,56 +33,6 @@ interface UploadSarifStatusReport
3233 extends StatusReportBase ,
3334 upload_lib . UploadStatusReport { }
3435
35- /**
36- * Searches for SARIF files for the given `analysis` in the given `sarifPath`.
37- * If any are found, then they are uploaded to the appropriate endpoint for the given `analysis`.
38- *
39- * @param logger The logger to use.
40- * @param features Information about FFs.
41- * @param sarifPath The path to a SARIF file or directory containing SARIF files.
42- * @param pathStats Information about `sarifPath`.
43- * @param checkoutPath The checkout path.
44- * @param analysis The configuration of the analysis we should upload SARIF files for.
45- * @param category The SARIF category to use for the upload.
46- * @returns The result of uploading the SARIF file(s) or `undefined` if there are none.
47- */
48- async function findAndUpload (
49- logger : Logger ,
50- features : Features ,
51- sarifPath : string ,
52- pathStats : fs . Stats ,
53- checkoutPath : string ,
54- analysis : analyses . AnalysisConfig ,
55- sarifPredicate : ( name : string ) => boolean ,
56- category ?: string ,
57- ) : Promise < upload_lib . UploadResult | undefined > {
58- let sarifFiles : string [ ] | undefined ;
59-
60- if ( pathStats . isDirectory ( ) ) {
61- sarifFiles = upload_lib . findSarifFilesInDir (
62- sarifPath ,
63- analysis . sarifPredicate ,
64- ) ;
65- } else if ( pathStats . isFile ( ) && sarifPredicate ( sarifPath ) ) {
66- sarifFiles = [ sarifPath ] ;
67- } else {
68- return undefined ;
69- }
70-
71- if ( sarifFiles . length !== 0 ) {
72- return await upload_lib . uploadSpecifiedFiles (
73- sarifFiles ,
74- checkoutPath ,
75- category ,
76- features ,
77- logger ,
78- analysis ,
79- ) ;
80- }
81-
82- return undefined ;
83- }
84-
8536async function sendSuccessStatusReport (
8637 startedAt : Date ,
8738 uploadStats : upload_lib . UploadStatusReport ,
0 commit comments