From 70e22e95384c0028a4a5a9679a729c3ac9224dcd Mon Sep 17 00:00:00 2001 From: brian-triplett Date: Mon, 19 Aug 2024 11:01:00 -0400 Subject: [PATCH] feat: updating push event trigger to use rest API (OctoKit) vs push event --- src/action.mjs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/action.mjs b/src/action.mjs index 6c74eb1..7d3d17a 100644 --- a/src/action.mjs +++ b/src/action.mjs @@ -22,13 +22,20 @@ const getCommitDepth = () => { return Number.isNaN(commitDepth) ? null : Math.max(commitDepth, 0) } -const getPushEventCommits = () => { - const mappedCommits = eventContext.payload.commits.map((commit) => ({ - message: commit.message, - hash: commit.id, - })) +const getPushEventCommits = async () => { + const octokit = getOctokit(getInput('token')) + const { owner, repo, before } = eventContext.issue + 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 () => {