5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 08:06:54 +00:00

feat: add firstParent input to ignore errors from your default branch

This commit is contained in:
Wagner Santos 2019-10-15 10:19:36 -03:00
parent 23cd801837
commit 598e473cb4
3 changed files with 16 additions and 0 deletions

View file

@ -26,6 +26,15 @@ jobs:
The path to your commitlint config file. Default `commitlint.config.js`.
### `firstParent`
When set to true, we follow only the first parent commit when seeing a merge commit.
This helps to ignore errors in commits that were already present in your default branch (e.g. `master`) before adding conventional commit checks.
More info in [git-log docs](https://git-scm.com/docs/git-log#Documentation/git-log.txt---first-parent).
Default `true`
## About `extends` in your config file
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:

View file

@ -5,6 +5,9 @@ inputs:
configFile:
description: 'commitlint config file'
default: './commitlint.config.js'
firstParent:
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'
default: true
runs:
using: 'docker'
image: 'docker://wagoid/commitlint-github-action:1.1.1'

4
run.js
View file

@ -40,6 +40,10 @@ function getHistoryCommits(from, to) {
to,
}
if (core.getInput('firstParent') === 'true') {
options.firstParent = true
}
if (!from) {
options.maxCount = 1
}