Skip to content

Commit 70e22e9

Browse files
feat: updating push event trigger to use rest API (OctoKit) vs push event
1 parent baa1b23 commit 70e22e9

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/action.mjs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@ const getCommitDepth = () => {
2222
return Number.isNaN(commitDepth) ? null : Math.max(commitDepth, 0)
2323
}
2424

25-
const getPushEventCommits = () => {
26-
const mappedCommits = eventContext.payload.commits.map((commit) => ({
27-
message: commit.message,
28-
hash: commit.id,
29-
}))
25+
const getPushEventCommits = async () => {
26+
const octokit = getOctokit(getInput('token'))
27+
const { owner, repo, before } = eventContext.issue
28+
const { data: commits } = await octokit.rest.repos.listCommits({
29+
owner,
30+
repo,
31+
sha: before,
32+
per_page: 100,
33+
})
3034

31-
return mappedCommits
35+
return commits.map((commit) => ({
36+
message: commit.commit.message,
37+
hash: commit.sha,
38+
}))
3239
}
3340

3441
const getPullRequestEventCommits = async () => {

0 commit comments

Comments
 (0)