@@ -235,6 +235,50 @@ const mockCore = {
235235 ( global . context . payload = { repository : { html_url : "https://github.com/testowner/testrepo" } } ) ,
236236 await eval ( `(async () => { ${ reactionScript } ; await main(); })()` ) ,
237237 expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( "Unsupported event type: push" ) ) ;
238+ } ) ,
239+ it ( "should silently ignore locked issue errors (status 403)" , async ( ) => {
240+ const lockedError = new Error ( "Issue is locked" ) ;
241+ lockedError . status = 403 ;
242+ ( ( process . env . GH_AW_REACTION = "eyes" ) ,
243+ ( global . context . eventName = "issues" ) ,
244+ ( global . context . payload = { issue : { number : 123 } , repository : { html_url : "https://github.com/testowner/testrepo" } } ) ,
245+ mockGithub . request . mockRejectedValueOnce ( lockedError ) ,
246+ await eval ( `(async () => { ${ reactionScript } ; await main(); })()` ) ,
247+ expect ( mockCore . info ) . toHaveBeenCalledWith ( expect . stringContaining ( "resource is locked" ) ) ,
248+ expect ( mockCore . error ) . not . toHaveBeenCalled ( ) ,
249+ expect ( mockCore . setFailed ) . not . toHaveBeenCalled ( ) ) ;
250+ } ) ,
251+ it ( "should silently ignore locked issue errors (message contains 'locked')" , async ( ) => {
252+ ( ( process . env . GH_AW_REACTION = "eyes" ) ,
253+ ( global . context . eventName = "issues" ) ,
254+ ( global . context . payload = { issue : { number : 123 } , repository : { html_url : "https://github.com/testowner/testrepo" } } ) ,
255+ mockGithub . request . mockRejectedValueOnce ( new Error ( "Lock conversation is enabled" ) ) ,
256+ await eval ( `(async () => { ${ reactionScript } ; await main(); })()` ) ,
257+ expect ( mockCore . info ) . toHaveBeenCalledWith ( expect . stringContaining ( "resource is locked" ) ) ,
258+ expect ( mockCore . error ) . not . toHaveBeenCalled ( ) ,
259+ expect ( mockCore . setFailed ) . not . toHaveBeenCalled ( ) ) ;
260+ } ) ,
261+ it ( "should fail for 403 errors that don't mention locked" , async ( ) => {
262+ const forbiddenError = new Error ( "Forbidden: insufficient permissions" ) ;
263+ forbiddenError . status = 403 ;
264+ ( ( process . env . GH_AW_REACTION = "eyes" ) ,
265+ ( global . context . eventName = "issues" ) ,
266+ ( global . context . payload = { issue : { number : 123 } , repository : { html_url : "https://github.com/testowner/testrepo" } } ) ,
267+ mockGithub . request . mockRejectedValueOnce ( forbiddenError ) ,
268+ await eval ( `(async () => { ${ reactionScript } ; await main(); })()` ) ,
269+ expect ( mockCore . error ) . toHaveBeenCalledWith ( expect . stringContaining ( "Failed to process reaction" ) ) ,
270+ expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( expect . stringContaining ( "Failed to process reaction" ) ) ) ;
271+ } ) ,
272+ it ( "should fail for other non-403 errors" , async ( ) => {
273+ const serverError = new Error ( "Internal server error" ) ;
274+ serverError . status = 500 ;
275+ ( ( process . env . GH_AW_REACTION = "eyes" ) ,
276+ ( global . context . eventName = "issues" ) ,
277+ ( global . context . payload = { issue : { number : 123 } , repository : { html_url : "https://github.com/testowner/testrepo" } } ) ,
278+ mockGithub . request . mockRejectedValueOnce ( serverError ) ,
279+ await eval ( `(async () => { ${ reactionScript } ; await main(); })()` ) ,
280+ expect ( mockCore . error ) . toHaveBeenCalledWith ( expect . stringContaining ( "Failed to process reaction" ) ) ,
281+ expect ( mockCore . setFailed ) . toHaveBeenCalledWith ( expect . stringContaining ( "Failed to process reaction" ) ) ) ;
238282 } ) ) ;
239283 } ) ) ;
240284 } ) ) ;
0 commit comments