@@ -20,7 +20,7 @@ import {
2020 telemetryCollector ,
2121} from './util'
2222
23- import { exec } from 'child_process '
23+ import path from 'path '
2424
2525const scaSarifReport = 'scaReport/output.sarif'
2626const scaReport = 'sca.sarif'
@@ -89,32 +89,22 @@ async function runAnalysis() {
8989async function displayResults ( ) {
9090 info ( 'Displaying results' )
9191 const downloadStart = Date . now ( )
92- await downloadArtifact ( 'results-old' )
93- await downloadArtifact ( 'results-new' )
92+ const artifactOld = await downloadArtifact ( 'results-old' )
93+ const artifactNew = await downloadArtifact ( 'results-new' )
9494 telemetryCollector . addField (
9595 'duration.download-artifacts' ,
9696 ( Date . now ( ) - downloadStart ) . toString ( )
9797 )
98+ const sarifFileOld = path . join ( artifactOld , scaReport )
99+ const sarifFileNew = path . join ( artifactNew , scaReport )
100+ console . log ( 'Artifact old: ' , sarifFileOld )
101+ console . log ( 'Artifact new: ' , sarifFileNew )
102+
98103 const issuesByTool : { [ tool : string ] : string } = { }
99- if ( existsSync ( `results-old/${ scaReport } ` ) && existsSync ( `results-new/${ scaReport } ` ) ) {
100- issuesByTool [ 'sca' ] = await compareResults (
101- 'sca' ,
102- `results-old/${ scaReport } ` ,
103- `results-new/${ scaReport } `
104- )
104+ if ( existsSync ( sarifFileOld ) && existsSync ( sarifFileNew ) ) {
105+ issuesByTool [ 'sca' ] = await compareResults ( 'sca' , sarifFileOld , sarifFileNew )
105106 } else {
106- exec ( 'ls -R -lh' , ( error , stdout , stderr ) => {
107- if ( error ) {
108- console . error ( `Error: ${ error . message } ` )
109- return
110- }
111- if ( stderr ) {
112- console . error ( `Stderr: ${ stderr } ` )
113- return
114- }
115- console . log ( `Output:\n${ stdout } ` )
116- } )
117- throw new Error ( 'No results found for SCA' )
107+ throw new Error ( 'SARIF file not found for SCA' )
118108 }
119109
120110 const commentStart = Date . now ( )
0 commit comments