5
0
Fork 0
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:
brian-triplett 2024-08-19 11:01:00 -04:00
parent baa1b236f9
commit 70e22e9538

View file

@ -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 () => {