10000 Merge branch 'wagoid:master' into master · ncino/commitlint-github-action@6740b6b · GitHub
[go: up one dir, main page]

Skip to content

Commit 6740b6b

Browse files
Merge branch 'wagoid:master' into master
2 parents 9e28575 + 3d28780 commit 6740b6b

File tree

7 files changed

+363
-100
lines changed

7 files changed

+363
-100
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
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.
44

5+
## [6.1.2](https://github.com/wagoid/commitlint-github-action/compare/v6.1.1...v6.1.2) (2024-09-04)
6+
7+
8+
### Bug Fixes
9+
10+
* 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))
11+
512
## [6.1.1](https://github.com/wagoid/commitlint-github-action/compare/v6.1.0...v6.1.1) (2024-08-21)
613

714
## [6.1.0](https://github.com/wagoid/commitlint-github-action/compare/v6.0.2...v6.1.0) (2024-08-20)

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ outputs:
3535
description: The error and warning messages for each one of the analyzed commits
3636
runs:
3737
using: docker
38-
image: docker://wagoid/commitlint-github-action:6.1.1
38+
image: docker://wagoid/commitlint-github-action:6.1.2
3939
branding:
4040
icon: check-square
4141
color: blue

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commitlint-github-action",
3-
"version": "6.1.1",
3+
"version": "6.1.2",
44
"description": "commitlint github action",
55
"private": true,
66
"module": "./dist/run.mjs",

src/action.mjs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const pullRequestTargetEvent = 'pull_request_target'
1212
const pullRequestEvents = [pullRequestEvent, pullRequestTargetEvent]
1313

1414
const { GITHUB_EVENT_NAME } = process.env
15+
const FIRST_COMMIT_SHA = '0000000000000000000000000000000000000000'
1516

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

@@ -22,13 +23,30 @@ const getCommitDepth = () => {
2223
return Number.isNaN(commitDepth) ? null : Math.max(commitDepth, 0)
2324
}
2425

25-
const getPushEventCommits = () => {
26-
const mappedCommits = eventContext.payload.commits.map((commit) => ({
27-
message: commit.message,
28-
hash: commit.id,
29-
}))
26+
const getPushEventCommits = async () => {
27+
const octokit = getOctokit(getInput('token'))
28+
const { owner, repo } = eventContext.issue
29+
const { before, after } = eventContext.payload
30+
31+
if (before === FIRST_COMMIT_SHA) {
32+
return eventContext.payload.commits.map((commit) => ({
33+
message: commit.message,
34+
hash: commit.id,
35+
}))
36+
}
3037

31-
return mappedCommits
38+
const { data: comparison } = await octokit.rest.repos.compareCommits({
39+
owner,
40+
repo,
41+
head: after,
42+
base: before,
43+
per_page: 100,
44+
})
45+
46+
return comparison.commits.map((commit) => ({
47+
message: commit.commit.message,
48+
hash: commit.sha,
49+
}))
3250
}
3351

3452
const getPullRequestEventCommits = async () => {

0 commit comments

Comments
 (0)
0