mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
feat: updating push event trigger to use rest API (OctoKit) vs push event
This commit is contained in:
parent
baa1b236f9
commit
70e22e9538
1 changed files with 13 additions and 6 deletions
|
|
@ -22,13 +22,20 @@ const getCommitDepth = () => {
|
||||||
return Number.isNaN(commitDepth) ? null : Math.max(commitDepth, 0)
|
return Number.isNaN(commitDepth) ? null : Math.max(commitDepth, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPushEventCommits = () => {
|
const getPushEventCommits = async () => {
|
||||||
const mappedCommits = eventContext.payload.commits.map((commit) => ({
|
const octokit = getOctokit(getInput('token'))
|
||||||
message: commit.message,
|
const { owner, repo, before } = eventContext.issue
|
||||||
hash: commit.id,
|
const { data: commits } = await octokit.rest.repos.listCommits({
|
||||||
}))
|
owner,
|
||||||
|
repo,
|
||||||
|
sha: before,
|
||||||
|
per_page: 100,
|
||||||
|
})
|
||||||
|
|
||||||
return mappedCommits
|
return commits.map((commit) => ({
|
||||||
|
message: commit.commit.message,
|
||||||
|
hash: commit.sha,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPullRequestEventCommits = async () => {
|
const getPullRequestEventCommits = async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue