File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { format } from '@commitlint/format'
7
7
import load from '@commitlint/load'
8
8
import generateOutputs from './generateOutputs.mjs'
9
9
10
+ const mergeGroupEvent = 'merge_group'
10
11
const pullRequestEvent = 'pull_request'
11
12
const pullRequestTargetEvent = 'pull_request_target'
12
13
const pullRequestEvents = [ pullRequestEvent , pullRequestTargetEvent ]
@@ -65,7 +66,30 @@ const getPullRequestEventCommits = async () => {
65
66
} ) )
66
67
}
67
68
69
+ const getMergeGroupEventCommits = async ( ) => {
70
+ const { merge_group } = eventContext . payload
71
+
72
+ if (
73
+ ! merge_group ||
74
+ ! merge_group . head_commit ||
75
+ ! merge_group . head_commit . message ||
76
+ ! merge_group . head_sha
77
+ ) {
78
+ throw new Error ( 'Invalid merge group data in event payload.' )
79
+ }
80
+
81
+ return [
82
+ {
83
+ message : merge_group . head_commit . message ,
84
+ hash : merge_group . head_sha ,
85
+ } ,
86
+ ]
87
+ }
88
+
68
89
const getEventCommits = async ( ) => {
90
+ if ( GITHUB_EVENT_NAME === mergeGroupEvent ) {
91
+ return getMergeGroupEventCommits ( )
92
+ }
69
93
if ( pullRequestEvents . includes ( GITHUB_EVENT_NAME ) ) {
70
94
return getPullRequestEventCommits ( )
71
95
}
You can’t perform that action at this time.
0 commit comments