@@ -9,6 +9,7 @@ vi.mock('../src/closeIssue.js', () => ({closeIssue: (...args: unknown[]) => clos
99
1010const inputs : Record < string , string > = { }
1111const infoLines : string [ ] = [ ]
12+ const warnLines : string [ ] = [ ]
1213const outputs : Record < string , string > = { }
1314vi . mock ( '@actions/core' , ( ) => ( {
1415 getInput : ( name : string ) => inputs [ name ] ?? '' ,
@@ -20,7 +21,9 @@ vi.mock('@actions/core', () => ({
2021 infoLines . push ( msg )
2122 } ,
2223 debug : ( ) => { } ,
23- warning : ( ) => { } ,
24+ warning : ( msg : string ) => {
25+ warnLines . push ( msg )
26+ } ,
2427 setFailed : ( ) => { } ,
2528} ) )
2629
@@ -89,6 +92,7 @@ describe('file action — wontfix label', () => {
8992 beforeEach ( ( ) => {
9093 vi . clearAllMocks ( )
9194 infoLines . length = 0
95+ warnLines . length = 0
9296 for ( const k of Object . keys ( inputs ) ) delete inputs [ k ]
9397 for ( const k of Object . keys ( outputs ) ) delete outputs [ k ]
9498 } )
@@ -117,4 +121,16 @@ describe('file action — wontfix label', () => {
117121 "Skipping reopen of issue labeled 'wontfix': https://github.com/org/repo/issues/1" ,
118122 )
119123 } )
124+
125+ it ( 'reopens as usual (and warns) when the label check fails' , async ( ) => {
126+ setup ( )
127+ // The label-check GET fails for every issue (e.g. transient API error)
128+ octokitRequest . mockRejectedValue ( new Error ( 'boom' ) )
129+
130+ await runFileAction ( )
131+
132+ // Both repeated filings should still be reopened rather than aborting the run
133+ expect ( reopenIssue ) . toHaveBeenCalledTimes ( 2 )
134+ expect ( warnLines . join ( '\n' ) ) . toContain ( 'Could not check labels for' )
135+ } )
120136} )
0 commit comments