@@ -551,6 +551,44 @@ describe("enqueueRelayPending", () => {
551551 expect ( JSON . parse ( rows . results [ 0 ] ?. raw_body ?? "{}" ) ) . toMatchObject ( { marker : "new" } ) ;
552552 } ) ;
553553
554+ it ( "does not let label-only PR events coalesce away pending gate-triggering PR events" , async ( ) => {
555+ const e = brokeredEnv ( ) ;
556+ const prBody = ( action : string , marker : string ) =>
557+ JSON . stringify ( {
558+ action,
559+ repository : { full_name : "JSONbored/Gittensory" } ,
560+ pull_request : { number : 1629 , head : { sha : "a" . repeat ( 40 ) } } ,
561+ marker,
562+ } ) ;
563+
564+ await enqueueRelayPending ( e , {
565+ deliveryId : "pr-opened-actionable" ,
566+ installationId : 9608 ,
567+ eventName : "pull_request" ,
568+ rawBody : prBody ( "opened" , "actionable" ) ,
569+ } ) ;
570+ await enqueueRelayPending ( e , {
571+ deliveryId : "pr-labeled-not-actionable" ,
572+ installationId : 9608 ,
573+ eventName : "pull_request" ,
574+ rawBody : prBody ( "labeled" , "label-only" ) ,
575+ } ) ;
576+
577+ const events = await pullRelayPending ( e , 9608 ) ;
578+ expect ( events . map ( ( event ) => event . deliveryId ) . sort ( ) ) . toEqual ( [
579+ "pr-labeled-not-actionable" ,
580+ "pr-opened-actionable" ,
581+ ] ) ;
582+ expect (
583+ Object . fromEntries (
584+ events . map ( ( event ) => [ event . deliveryId , JSON . parse ( event . rawBody ) . action ] ) ,
585+ ) ,
586+ ) . toEqual ( {
587+ "pr-labeled-not-actionable" : "labeled" ,
588+ "pr-opened-actionable" : "opened" ,
589+ } ) ;
590+ } ) ;
591+
554592 it ( "keeps exact duplicate coalescible delivery IDs idempotent" , async ( ) => {
555593 const e = brokeredEnv ( ) ;
556594 const body = ( marker : string ) =>
0 commit comments