@@ -7,7 +7,10 @@ import {
77} from "../../types.ts" ;
88import { type Output } from "../Output.ts" ;
99import { debug } from "../logging.ts" ;
10- import { type PullRequestEvent } from "@octokit/webhooks-definitions/schema" ;
10+ import {
11+ type PullRequestEvent ,
12+ type MergeGroupEvent ,
13+ } from "@octokit/webhooks-types" ;
1114
1215export function detect ( envs : ProviderEnvs ) : boolean {
1316 return Boolean ( envs ?. GITHUB_ACTIONS ) ;
@@ -42,7 +45,7 @@ async function _getJobURL(
4245 } ) ;
4346
4447 if ( res . status !== 200 ) {
45- debug ( `Failed to get job URL : ${ res . status } ` , { enabled : output . debug } ) ;
48+ debug ( `Failed to get job U1RL : ${ res . status } ` , { enabled : output . debug } ) ;
4649 return null ;
4750 }
4851
@@ -184,9 +187,12 @@ function _getSHA(
184187
185188 const context = GitHub . context ;
186189 let commit = envs ?. GITHUB_SHA ;
187- if ( [ "pull_request" , " pull_request_target" ] . includes ( context . eventName ) ) {
190+ if ( [ "pull_request" , "pull_request_target" ] . includes ( context . eventName ) ) {
188191 const payload = context . payload as PullRequestEvent ;
189192 commit = payload . pull_request . head . sha ;
193+ } else if ( "merge_group" === context . eventName ) {
194+ const payload = context . payload as MergeGroupEvent ;
195+ commit = payload . merge_group . head_sha ;
190196 }
191197
192198 debug ( `Using commit: ${ commit ?? null } ` , { enabled : output . debug } ) ;
@@ -205,9 +211,12 @@ function _getCompareSHA(
205211
206212 let compareSha = null ;
207213 const context = GitHub . context ;
208- if ( [ "pull_request" , " pull_request_target" ] . includes ( context . eventName ) ) {
214+ if ( [ "pull_request" , "pull_request_target" ] . includes ( context . eventName ) ) {
209215 const payload = context . payload as PullRequestEvent ;
210216 compareSha = payload . pull_request . base . sha ;
217+ } else if ( "merge_group" === context . eventName ) {
218+ const payload = context . payload as MergeGroupEvent ;
219+ compareSha = payload . merge_group . base_sha ;
211220 }
212221
213222 debug ( `Using compareSha: ${ compareSha } ` , { enabled : output . debug } ) ;
0 commit comments