Skip to content

Commit 598e473

Browse files
committed
feat: add firstParent input to ignore errors from your default branch
1 parent 23cd801 commit 598e473

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ jobs:
2626

2727
The path to your commitlint config file. Default `commitlint.config.js`.
2828

29+
### `firstParent`
30+
31+
When set to true, we follow only the first parent commit when seeing a merge commit.
32+
33+
This helps to ignore errors in commits that were already present in your default branch (e.g. `master`) before adding conventional commit checks.
34+
More info in [git-log docs](https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent).
35+
36+
Default `true`
37+
2938
## About `extends` in your config file
3039

3140
This is a [`Docker` action](https://github.com/actions/toolkit/blob/e2adf403d6d14a9ca7474976ccaca20f72ff8209/docs/action-types.md#why-would-i-choose-a-docker-action), and was made like this so that you can run it with minimum setup, regardless of your repo's environment. It comes packed with the most famous shared configurations that you can use in your commitlint config's `extends` field:

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
configFile:
66
description: 'commitlint config file'
77
default: './commitlint.config.js'
8+
firstParent:
9+
description: 'when set to true, we follow only the first parent commit when seeing a merge commit. More info in git-log docs https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent'
10+
default: true
811
runs:
912
using: 'docker'
1013
image: 'docker://wagoid/commitlint-github-action:1.1.1'

run.js

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ function getHistoryCommits(from, to) {
4040
to,
4141
}
4242

43+
if (core.getInput('firstParent') === 'true') {
44+
options.firstParent = true
45+
}
46+
4347
if (!from) {
4448
options.maxCount = 1
4549
}

0 commit comments

Comments
 (0)