Skip to content

Commit

Permalink
feat: add firstParent input to ignore errors from your default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoid committed Oct 15, 2019
1 parent 23cd801 commit 598e473
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function getHistoryCommits(from, to) {
to,
}

if (core.getInput('firstParent') === 'true') {
options.firstParent = true
}

if (!from) {
options.maxCount = 1
}
Expand Down

0 comments on commit 598e473

Please sign in to comment.