@@ -105,6 +105,17 @@ function run() {
105105 const external_id = core . getInput ( "EXTERNAL_ID" ) ;
106106 const block_on_severity = core . getInput ( "BLOCK_ON_SEVERITY" ) ;
107107 const warn_on_severity = core . getInput ( "WARN_ON_SEVERITY" ) ;
108+ const polling_timeout = core . getInput ( "POLLING_TIMEOUT" ) ;
109+ var parsed_polling_timeout ;
110+ if ( polling_timeout ) {
111+ parsed_polling_timeout = parseInt ( polling_timeout , 10 ) ;
112+ if ( isNaN ( parsed_polling_timeout ) ) {
113+ throw new Error ( "POLLING_TIMEOUT must be a number" ) ;
114+ }
115+ if ( parsed_polling_timeout <= 0 ) {
116+ throw new Error ( "POLLING_TIMEOUT must be greater than 0" ) ;
117+ }
118+ }
108119 // Validate severity levels
109120 if ( block_on_severity &&
110121 ! [ "HIGH" , "MEDIUM" , "LOW" ] . includes ( block_on_severity . toUpperCase ( ) ) ) {
@@ -259,8 +270,11 @@ function run() {
259270 }
260271 for ( const scan of scan_info ) {
261272 const { mobile_app_id, scan_id } = scan ;
262- // Poll for scan completion with 30-second intervals
263- const maxWaitTime = 300000 ; // 5 minutes
273+ var maxWaitTime = 300000 ; // 5 minutes
274+ if ( parsed_polling_timeout ) {
275+ maxWaitTime = parsed_polling_timeout * 1000 ;
276+ }
277+ // Poll for scan completion with 23-second intervals
264278 const pollInterval = 23000 ; // 23 seconds
265279 const startTime = Date . now ( ) ;
266280 console . log ( `Waiting for scan ${ scan_id } to complete...` ) ;
@@ -277,8 +291,9 @@ function run() {
277291 continue ;
278292 }
279293 const status_data = yield status_response . json ( ) ;
280- if ( status_data . static_scan &&
281- status_data . static_scan . status === "FAILED" ) {
294+ const scan_status = status_data . static_scan . status || status_data . status ;
295+ if ( scan_status &&
296+ [ "FAILED" , "SCAN_ATTEMPT_ERROR" , "CANCELLED" ] . includes ( scan_status ) ) {
282297 console . log ( `Scan ${ scan_id } failed, skipping vulnerability check` ) ;
283298 break ;
284299 }
0 commit comments