@@ -124,11 +124,7 @@ test('it raises an error when no refs are provided and the event is not a pull r
124124 ) . toThrow ( )
125125} )
126126
127- const pullRequestLikeEvents = [
128- 'pull_request' ,
129- 'pull_request_target' ,
130- 'merge_group'
131- ]
127+ const pullRequestLikeEvents = [ 'pull_request' , 'pull_request_target' ]
132128
133129test . each ( pullRequestLikeEvents ) (
134130 'it uses the given refs even when the event is %s' ,
@@ -152,7 +148,7 @@ test.each(pullRequestLikeEvents)(
152148)
153149
154150test . each ( pullRequestLikeEvents ) (
155- 'it uses the event refs when the event is %s and the no refs are input ' ,
151+ 'it uses the event refs when the event is %s and no refs are provided in config ' ,
156152 async eventName => {
157153 const refs = getRefs ( await readConfig ( ) , {
158154 payload : {
@@ -169,6 +165,37 @@ test.each(pullRequestLikeEvents)(
169165 }
170166)
171167
168+ test ( 'it uses the given refs even when the event is merge_group' , async ( ) => {
169+ setInput ( 'base-ref' , 'a-custom-base-ref' )
170+ setInput ( 'head-ref' , 'a-custom-head-ref' )
171+
172+ const refs = getRefs ( await readConfig ( ) , {
173+ payload : {
174+ merge_group : {
175+ base_sha : 'pr-base-ref' ,
176+ head_sha : 'pr-head-ref'
177+ }
178+ } ,
179+ eventName : 'merge_group'
180+ } )
181+ expect ( refs . base ) . toEqual ( 'a-custom-base-ref' )
182+ expect ( refs . head ) . toEqual ( 'a-custom-head-ref' )
183+ } )
184+
185+ test ( 'it uses the event refs when the event is %s and no refs are provided in config' , async ( ) => {
186+ const refs = getRefs ( await readConfig ( ) , {
187+ payload : {
188+ merge_group : {
189+ base_sha : 'pr-base-ref' ,
190+ head_sha : 'pr-head-ref'
191+ }
192+ } ,
193+ eventName : 'merge_group'
194+ } )
195+ expect ( refs . base ) . toEqual ( 'pr-base-ref' )
196+ expect ( refs . head ) . toEqual ( 'pr-head-ref' )
197+ } )
198+
172199test ( 'it defaults to runtime scope' , async ( ) => {
173200 const config = await readConfig ( )
174201 expect ( config . fail_on_scopes ) . toEqual ( [ 'runtime' ] )
0 commit comments