@@ -268,14 +268,38 @@ describe("check_skip_if_check_failing.cjs", () => {
268268 expect ( mockCore . setOutput ) . toHaveBeenCalledWith ( "skip_if_check_failing_ok" , "true" ) ;
269269 } ) ;
270270
271- it ( "should fail with error message when API call fails" , async ( ) => {
272- mockGithub . paginate . mockRejectedValue ( new Error ( "Rate limit exceeded" ) ) ;
271+ it ( "should allow workflow when API call fails due to rate limiting (fail-open)" , async ( ) => {
272+ mockGithub . paginate . mockRejectedValue ( new Error ( "API rate limit exceeded for installation" ) ) ;
273+
274+ const { main } = await import ( "./check_skip_if_check_failing.cjs" ) ;
275+ await main ( ) ;
276+
277+ // Rate limit errors should fail-open: allow the workflow to proceed
278+ expect ( mockCore . setFailed ) . not . toHaveBeenCalled ( ) ;
279+ expect ( mockCore . warning ) . toHaveBeenCalledWith ( expect . stringContaining ( "rate limit" ) ) ;
280+ expect ( mockCore . setOutput ) . toHaveBeenCalledWith ( "skip_if_check_failing_ok" , "true" ) ;
281+ } ) ;
282+
283+ it ( "should allow workflow when API call fails with 'rate limit exceeded' message (fail-open)" , async ( ) => {
284+ mockGithub . paginate . mockRejectedValue ( new Error ( "rate limit exceeded: please retry after 60 seconds" ) ) ;
285+
286+ const { main } = await import ( "./check_skip_if_check_failing.cjs" ) ;
287+ await main ( ) ;
288+
289+ // 'rate limit exceeded' variant should also fail-open
290+ expect ( mockCore . setFailed ) . not . toHaveBeenCalled ( ) ;
291+ expect ( mockCore . warning ) . toHaveBeenCalledWith ( expect . stringContaining ( "rate limit" ) ) ;
292+ expect ( mockCore . setOutput ) . toHaveBeenCalledWith ( "skip_if_check_failing_ok" , "true" ) ;
293+ } ) ;
294+
295+ it ( "should fail with error message when non-rate-limit API call fails" , async ( ) => {
296+ mockGithub . paginate . mockRejectedValue ( new Error ( "Network connection error" ) ) ;
273297
274298 const { main } = await import ( "./check_skip_if_check_failing.cjs" ) ;
275299 await main ( ) ;
276300
277301 expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( expect . stringContaining ( "Failed to fetch check runs" ) ) ;
278- expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( expect . stringContaining ( "Rate limit exceeded " ) ) ;
302+ expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( expect . stringContaining ( "Network connection error " ) ) ;
279303 expect ( mockCore . setOutput ) . not . toHaveBeenCalled ( ) ;
280304 } ) ;
281305
0 commit comments