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

add excludeTarget input option

This commit is contained in:
Michael Welch 2023-01-26 16:03:07 -06:00
parent 481aff4de4
commit bd13a3ec66
No known key found for this signature in database
GPG key ID: 9F967870859A261E
3 changed files with 18 additions and 0 deletions

View file

@ -72,6 +72,12 @@ You can see more info about GitHub's default token [here](https://docs.github.co
default: `${{ github.token }}` default: `${{ github.token }}`
### `excludeTarget`
When set to `true` excludes commits from the target branch.
default: `false`
## Outputs ## Outputs
### `results` ### `results`

View file

@ -34,6 +34,14 @@ inputs:
https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
default: ${{ github.token }} default: ${{ github.token }}
required: false required: false
excludeTarget:
description: >
When set to `true` excludes commits from the target branch. This is useful on merge commits of two
divergent branches. By default all of the commits in the target branch that are not in the source
branch will be linted again. Set this to `true` to avoid that.
default: "false"
required: false
outputs: outputs:
results: results:
description: The error and warning messages for each one of the analyzed commits description: The error and warning messages for each one of the analyzed commits

View file

@ -78,6 +78,10 @@ function getHistoryCommits(from, to) {
options.firstParent = true options.firstParent = true
} }
if (getInput('excludeTarget') === 'true') {
options[`^${to}`] = true
}
if (!from) { if (!from) {
options.maxCount = 1 options.maxCount = 1
} }