@@ -49,16 +49,14 @@ async function runAnalysis() {
4949 }
5050 }
5151
52- const enableIacRunning = true
53-
5452 // Create scan-results directory
5553 const resultsPath = path . join ( process . cwd ( ) , 'scan-results' )
5654
5755 // Cache the analysis results when scanning the target branch
5856 let cacheHit = false
5957 let cacheKey : string | undefined
6058 if ( targetScan === 'old' ) {
61- cacheKey = await generateCacheKey ( enableIacRunning , targetScan , modifiedFiles )
59+ cacheKey = await generateCacheKey ( targetScan , modifiedFiles )
6260 if ( cacheKey ) {
6361 const restored = await cache . restoreCache ( [ resultsPath ] , cacheKey )
6462 if ( restored ) {
@@ -73,11 +71,11 @@ async function runAnalysis() {
7371 }
7472
7573 if ( ! cacheHit ) {
76- let success = await runCodesec ( 'scan' , enableIacRunning , resultsPath , targetScan , modifiedFiles )
74+ let success = await runCodesec ( 'scan' , true , resultsPath , targetScan , modifiedFiles )
7775 if ( success && targetScan !== 'new' ) {
7876 // Save the analysis results when not scanning the PR source branch
7977 if ( ! cacheKey ) {
80- cacheKey = await generateCacheKey ( enableIacRunning , targetScan , modifiedFiles )
78+ cacheKey = await generateCacheKey ( targetScan , modifiedFiles )
8179 }
8280 if ( cacheKey ) {
8381 try {
@@ -99,14 +97,12 @@ async function runAnalysis() {
9997 break
10098 }
10199 }
102- if ( enableIacRunning ) {
103- const iacDir = path . join ( resultsPath , 'iac' )
104- for ( const name of possibleNames ) {
105- const existing = path . join ( iacDir , `iac-${ name } .json` )
106- if ( existsSync ( existing ) && name !== targetScan ) {
107- renameSync ( existing , path . join ( iacDir , `iac-${ targetScan } .json` ) )
108- break
109- }
100+ const iacDir = path . join ( resultsPath , 'iac' )
101+ for ( const name of possibleNames ) {
102+ const existing = path . join ( iacDir , `iac-${ name } .json` )
103+ if ( existsSync ( existing ) && name !== targetScan ) {
104+ renameSync ( existing , path . join ( iacDir , `iac-${ targetScan } .json` ) )
105+ break
110106 }
111107 }
112108 }
@@ -128,14 +124,12 @@ async function runAnalysis() {
128124 }
129125
130126 // Upload IAC JSON from the returned results path
131- if ( enableIacRunning ) {
132- const iacJsonFile = path . join ( resultsPath , 'iac' , `iac-${ targetScan } .json` )
133- if ( existsSync ( iacJsonFile ) ) {
134- info ( `Found IAC JSON file to upload: ${ iacJsonFile } ` )
135- toUpload . push ( iacJsonFile )
136- } else {
137- info ( `IAC JSON file not found at: ${ iacJsonFile } ` )
138- }
127+ const iacJsonFile = path . join ( resultsPath , 'iac' , `iac-${ targetScan } .json` )
128+ if ( existsSync ( iacJsonFile ) ) {
129+ info ( `Found IAC JSON file to upload: ${ iacJsonFile } ` )
130+ toUpload . push ( iacJsonFile )
131+ } else {
132+ info ( `IAC JSON file not found at: ${ iacJsonFile } ` )
139133 }
140134
141135 const artifactName = 'results-' + target
@@ -145,8 +139,6 @@ async function runAnalysis() {
145139}
146140
147141async function displayResults ( ) {
148- const enableIacRunning = true
149-
150142 info ( 'Displaying results' )
151143
152144 // Download artifacts from previous jobs
@@ -155,21 +147,18 @@ async function displayResults() {
155147
156148 // Create local scan-results directory for compare
157149 mkdirSync ( 'scan-results/sca' , { recursive : true } )
158- if ( enableIacRunning ) {
159- mkdirSync ( 'scan-results/iac' , { recursive : true } )
160- }
150+ mkdirSync ( 'scan-results/iac' , { recursive : true } )
161151
162152 // Check and copy files for each scanner type
163153 if ( ! ( await prepareScannerFiles ( 'sca' , artifactOld , artifactNew ) ) ) {
164154 error ( 'SCA files not found. Cannot perform compare.' )
165155 return
166156 }
167- const iacAvailable =
168- enableIacRunning && ( await prepareScannerFiles ( 'iac' , artifactOld , artifactNew ) )
157+ const iacAvailable = await prepareScannerFiles ( 'iac' , artifactOld , artifactNew )
169158
170159 // Run codesec compare mode with available scanners
171160 const resultsPath = path . join ( process . cwd ( ) , 'scan-results' )
172- await runCodesec ( 'compare' , enableIacRunning && iacAvailable , resultsPath )
161+ await runCodesec ( 'compare' , iacAvailable , resultsPath )
173162
174163 // Read comparison output - check all possible outputs
175164 const outputs = [
0 commit comments