Skip to content

Commit

Permalink
Merge branch 'wagoid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian-Triplett authored Sep 10, 2024
2 parents 9e28575 + 3d28780 commit 6740b6b
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 100 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [6.1.2](https://github.com/wagoid/commitlint-github-action/compare/v6.1.1...v6.1.2) (2024-09-04)


### Bug Fixes

* using compareCommits for push event commit query ([#801](https://github.com/wagoid/commitlint-github-action/issues/801)) ([47ff131](https://github.com/wagoid/commitlint-github-action/commit/47ff1315a12847478779c4d002c30f406009e206))

## [6.1.1](https://github.com/wagoid/commitlint-github-action/compare/v6.1.0...v6.1.1) (2024-08-21)

## [6.1.0](https://github.com/wagoid/commitlint-github-action/compare/v6.0.2...v6.1.0) (2024-08-20)
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ outputs:
description: The error and warning messages for each one of the analyzed commits
runs:
using: docker
image: docker://wagoid/commitlint-github-action:6.1.1
image: docker://wagoid/commitlint-github-action:6.1.2
branding:
icon: check-square
color: blue
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commitlint-github-action",
"version": "6.1.1",
"version": "6.1.2",
"description": "commitlint github action",
"private": true,
"module": "./dist/run.mjs",
Expand Down
30 changes: 24 additions & 6 deletions src/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const pullRequestTargetEvent = 'pull_request_target'
const pullRequestEvents = [pullRequestEvent, pullRequestTargetEvent]

const { GITHUB_EVENT_NAME } = process.env
const FIRST_COMMIT_SHA = '0000000000000000000000000000000000000000'

const configPath = resolve(process.env.GITHUB_WORKSPACE, getInput('configFile'))

Expand All @@ -22,13 +23,30 @@ 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 } = eventContext.issue
const { before, after } = eventContext.payload

if (before === FIRST_COMMIT_SHA) {
return eventContext.payload.commits.map((commit) => ({
message: commit.message,
hash: commit.id,
}))
}

return mappedCommits
const { data: comparison } = await octokit.rest.repos.compareCommits({
owner,
repo,
head: after,
base: before,
per_page: 100,
})

return comparison.commits.map((commit) => ({
message: commit.commit.message,
hash: commit.sha,
}))
}

const getPullRequestEventCommits = async () => {
Expand Down
Loading

0 comments on commit 6740b6b

Please sign in to comment.