@@ -391,32 +391,6 @@ export function findSarifFilesInDir(sarifPath: string): string[] {
391
391
return sarifFiles ;
392
392
}
393
393
394
- /**
395
- * Uploads a single SARIF file or a directory of SARIF files depending on what `sarifPath` refers
396
- * to.
397
- */
398
- export async function uploadFromActions (
399
- sarifPath : string ,
400
- checkoutPath : string ,
401
- category : string | undefined ,
402
- logger : Logger ,
403
- ) : Promise < UploadResult > {
404
- return await uploadFiles (
405
- getSarifFilePaths ( sarifPath ) ,
406
- parseRepositoryNwo ( util . getRequiredEnvParam ( "GITHUB_REPOSITORY" ) ) ,
407
- await actionsUtil . getCommitOid ( checkoutPath ) ,
408
- await actionsUtil . getRef ( ) ,
409
- await api . getAnalysisKey ( ) ,
410
- category ,
411
- util . getRequiredEnvParam ( "GITHUB_WORKFLOW" ) ,
412
- actionsUtil . getWorkflowRunID ( ) ,
413
- actionsUtil . getWorkflowRunAttempt ( ) ,
414
- checkoutPath ,
415
- actionsUtil . getRequiredInput ( "matrix" ) ,
416
- logger ,
417
- ) ;
418
- }
419
-
420
394
function getSarifFilePaths ( sarifPath : string ) {
421
395
if ( ! fs . existsSync ( sarifPath ) ) {
422
396
// This is always a configuration error, even for first-party runs.
@@ -563,22 +537,21 @@ export function buildPayload(
563
537
return payloadObj ;
564
538
}
565
539
566
- // Uploads the given set of sarif files.
567
- // Returns true iff the upload occurred and succeeded
568
- async function uploadFiles (
569
- sarifFiles : string [ ] ,
570
- repositoryNwo : RepositoryNwo ,
571
- commitOid : string ,
572
- ref : string ,
573
- analysisKey : string ,
540
+ /**
541
+ * Uploads a single SARIF file or a directory of SARIF files depending on what `sarifPath` refers
542
+ * to.
543
+ */
544
+ export async function uploadFiles (
545
+ sarifPath : string ,
546
+ checkoutPath : string ,
574
547
category : string | undefined ,
575
- analysisName : string | undefined ,
576
- workflowRunID : number ,
577
- workflowRunAttempt : number ,
578
- sourceRoot : string ,
579
- environment : string | undefined ,
580
548
logger : Logger ,
581
549
) : Promise < UploadResult > {
550
+ const repositoryNwo = parseRepositoryNwo (
551
+ util . getRequiredEnvParam ( "GITHUB_REPOSITORY" ) ,
552
+ ) ;
553
+ const sarifFiles = getSarifFilePaths ( sarifPath ) ;
554
+
582
555
logger . startGroup ( "Uploading results" ) ;
583
556
logger . info ( `Processing sarif files: ${ JSON . stringify ( sarifFiles ) } ` ) ;
584
557
@@ -601,8 +574,10 @@ async function uploadFiles(
601
574
features ,
602
575
logger ,
603
576
) ;
604
- sarif = await fingerprints . addFingerprints ( sarif , sourceRoot , logger ) ;
577
+ sarif = await fingerprints . addFingerprints ( sarif , checkoutPath , logger ) ;
605
578
579
+ const analysisKey = await api . getAnalysisKey ( ) ;
580
+ const environment = actionsUtil . getRequiredInput ( "matrix" ) ;
606
581
sarif = populateRunAutomationDetails (
607
582
sarif ,
608
583
category ,
@@ -618,16 +593,16 @@ async function uploadFiles(
618
593
const sarifPayload = JSON . stringify ( sarif ) ;
619
594
logger . debug ( `Compressing serialized SARIF` ) ;
620
595
const zippedSarif = zlib . gzipSync ( sarifPayload ) . toString ( "base64" ) ;
621
- const checkoutURI = fileUrl ( sourceRoot ) ;
596
+ const checkoutURI = fileUrl ( checkoutPath ) ;
622
597
623
598
const payload = buildPayload (
624
- commitOid ,
625
- ref ,
599
+ await actionsUtil . getCommitOid ( checkoutPath ) ,
600
+ await actionsUtil . getRef ( ) ,
626
601
analysisKey ,
627
- analysisName ,
602
+ category ,
628
603
zippedSarif ,
629
- workflowRunID ,
630
- workflowRunAttempt ,
604
+ actionsUtil . getWorkflowRunID ( ) ,
605
+ actionsUtil . getWorkflowRunAttempt ( ) ,
631
606
checkoutURI ,
632
607
environment ,
633
608
toolNames ,
0 commit comments