@@ -18,9 +18,6 @@ import {
1818 generateCacheKey ,
1919} from './util'
2020
21- // Set to false to disable SCA globally
22- const enableScaRunning = true
23-
2421async function runAnalysis ( ) {
2522 const target = getInput ( 'target' )
2623
@@ -68,7 +65,7 @@ async function runAnalysis() {
6865 let cacheHit = false
6966 let cacheKey : string | undefined
7067 if ( targetScan === 'old' ) {
71- cacheKey = await generateCacheKey ( enableIacRunning , enableScaRunning , targetScan , modifiedFiles )
68+ cacheKey = await generateCacheKey ( enableIacRunning , targetScan , modifiedFiles )
7269 if ( cacheKey ) {
7370 const restored = await cache . restoreCache ( [ resultsPath ] , cacheKey )
7471 if ( restored ) {
@@ -83,23 +80,11 @@ async function runAnalysis() {
8380 }
8481
8582 if ( ! cacheHit ) {
86- let success = await runCodesec (
87- 'scan' ,
88- enableIacRunning ,
89- enableScaRunning ,
90- resultsPath ,
91- targetScan ,
92- modifiedFiles
93- )
83+ let success = await runCodesec ( 'scan' , enableIacRunning , resultsPath , targetScan , modifiedFiles )
9484 if ( success && targetScan !== 'new' ) {
9585 // Save the analysis results when not scanning the PR source branch
9686 if ( ! cacheKey ) {
97- cacheKey = await generateCacheKey (
98- enableIacRunning ,
99- enableScaRunning ,
100- targetScan ,
101- modifiedFiles
102- )
87+ cacheKey = await generateCacheKey ( enableIacRunning , targetScan , modifiedFiles )
10388 }
10489 if ( cacheKey ) {
10590 try {
@@ -113,14 +98,12 @@ async function runAnalysis() {
11398 } else {
11499 // Cache restored — rename files to match current targetScan if needed
115100 const possibleNames = [ 'old' , 'scan' ]
116- if ( enableScaRunning ) {
117- const scaDir = path . join ( resultsPath , 'sca' )
118- for ( const name of possibleNames ) {
119- const existing = path . join ( scaDir , `sca-${ name } .sarif` )
120- if ( existsSync ( existing ) && name !== targetScan ) {
121- renameSync ( existing , path . join ( scaDir , `sca-${ targetScan } .sarif` ) )
122- break
123- }
101+ const scaDir = path . join ( resultsPath , 'sca' )
102+ for ( const name of possibleNames ) {
103+ const existing = path . join ( scaDir , `sca-${ name } .sarif` )
104+ if ( existsSync ( existing ) && name !== targetScan ) {
105+ renameSync ( existing , path . join ( scaDir , `sca-${ targetScan } .sarif` ) )
106+ break
124107 }
125108 }
126109 if ( enableIacRunning ) {
@@ -136,21 +119,19 @@ async function runAnalysis() {
136119 }
137120
138121 // Upload SCA SARIF from the returned results path
139- if ( enableScaRunning ) {
140- const scaSarifFile = path . join ( resultsPath , 'sca' , `sca-${ targetScan } .sarif` )
141- if ( existsSync ( scaSarifFile ) ) {
142- info ( `Found SCA SARIF file to upload: ${ scaSarifFile } ` )
143- toUpload . push ( scaSarifFile )
144-
145- // Copy SARIF to code-scanning-path for backward compatibility
146- const codeScanningPath = getInput ( 'code-scanning-path' )
147- if ( codeScanningPath ) {
148- info ( `Copying SARIF to code-scanning-path: ${ codeScanningPath } ` )
149- copyFileSync ( scaSarifFile , codeScanningPath )
150- }
151- } else {
152- info ( `SCA SARIF file not found at: ${ scaSarifFile } ` )
122+ const scaSarifFile = path . join ( resultsPath , 'sca' , `sca-${ targetScan } .sarif` )
123+ if ( existsSync ( scaSarifFile ) ) {
124+ info ( `Found SCA SARIF file to upload: ${ scaSarifFile } ` )
125+ toUpload . push ( scaSarifFile )
126+
127+ // Copy SARIF to code-scanning-path for backward compatibility
128+ const codeScanningPath = getInput ( 'code-scanning-path' )
129+ if ( codeScanningPath ) {
130+ info ( `Copying SARIF to code-scanning-path: ${ codeScanningPath } ` )
131+ copyFileSync ( scaSarifFile , codeScanningPath )
153132 }
133+ } else {
134+ info ( `SCA SARIF file not found at: ${ scaSarifFile } ` )
154135 }
155136
156137 // Upload IAC JSON from the returned results path
@@ -180,16 +161,13 @@ async function displayResults() {
180161 const artifactNew = await downloadArtifact ( 'results-new' )
181162
182163 // Create local scan-results directory for compare
183- if ( enableScaRunning ) {
184- mkdirSync ( 'scan-results/sca' , { recursive : true } )
185- }
164+ mkdirSync ( 'scan-results/sca' , { recursive : true } )
186165 if ( enableIacRunning ) {
187166 mkdirSync ( 'scan-results/iac' , { recursive : true } )
188167 }
189168
190169 // Check and copy files for each scanner type
191- const scaAvailable =
192- enableScaRunning && ( await prepareScannerFiles ( 'sca' , artifactOld , artifactNew ) )
170+ const scaAvailable = await prepareScannerFiles ( 'sca' , artifactOld , artifactNew )
193171 const iacAvailable =
194172 enableIacRunning && ( await prepareScannerFiles ( 'iac' , artifactOld , artifactNew ) )
195173
@@ -202,12 +180,7 @@ async function displayResults() {
202180
203181 // Run codesec compare mode with available scanners
204182 const resultsPath = path . join ( process . cwd ( ) , 'scan-results' )
205- await runCodesec (
206- 'compare' ,
207- enableIacRunning && iacAvailable ,
208- enableScaRunning && scaAvailable ,
209- resultsPath
210- )
183+ await runCodesec ( 'compare' , enableIacRunning && iacAvailable , resultsPath )
211184
212185 // Read comparison output - check all possible outputs
213186 const outputs = [
0 commit comments