Skip to content

Commit

Permalink
feat: updating push event trigger to use rest API (OctoKit) vs push e…
Browse files Browse the repository at this point in the history
…vent
  • Loading branch information
Brian-Triplett committed Aug 19, 2024
1 parent baa1b23 commit 70e22e9
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 70e22e9

Please sign in to comment.