mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
feat: handle merge_group event - get squashed commit
This commit is contained in:
parent
3d28780bbf
commit
fa634960b5
1 changed files with 15 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import { format } from '@commitlint/format'
|
|||
import load from '@commitlint/load'
|
||||
import generateOutputs from './generateOutputs.mjs'
|
||||
|
||||
const mergeGroupEvent = 'merge_group'
|
||||
const pullRequestEvent = 'pull_request'
|
||||
const pullRequestTargetEvent = 'pull_request_target'
|
||||
const pullRequestEvents = [pullRequestEvent, pullRequestTargetEvent]
|
||||
|
|
@ -65,7 +66,21 @@ const getPullRequestEventCommits = async () => {
|
|||
}))
|
||||
}
|
||||
|
||||
const getMergeGroupEventCommits = async () => {
|
||||
const { merge_group } = eventContext.payload
|
||||
|
||||
return [
|
||||
{
|
||||
message: merge_group.head_commit.message,
|
||||
hash: merge_group.head_sha,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
const getEventCommits = async () => {
|
||||
if (GITHUB_EVENT_NAME === mergeGroupEvent) {
|
||||
return getMergeGroupEventCommits()
|
||||
}
|
||||
if (pullRequestEvents.includes(GITHUB_EVENT_NAME)) {
|
||||
return getPullRequestEventCommits()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue