-
Notifications
You must be signed in to change notification settings - Fork 61
add excludeTargetBranch input option #656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,17 @@ inputs: | |
https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token | ||
default: ${{ github.token }} | ||
required: false | ||
excludeTargetBranch: | ||
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. | ||
|
||
TODO: This explanation can be made better when I better understand why `--firstParent` alone didn't resolve this. | ||
To do that I need to understand what `git log <revision range>` is doing. | ||
default: "false" | ||
required: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we understand the root problem better, then perhaps this should default to |
||
|
||
outputs: | ||
results: | ||
description: The error and warning messages for each one of the analyzed commits | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ const pullRequestEvent = 'pull_request' | |
const pullRequestTargetEvent = 'pull_request_target' | ||
const pullRequestEvents = [pullRequestEvent, pullRequestTargetEvent] | ||
|
||
const { GITHUB_EVENT_NAME, GITHUB_SHA } = process.env | ||
const { GITHUB_EVENT_NAME, GITHUB_SHA, GITHUB_BASE_REF } = process.env | ||
|
||
const configPath = resolve(process.env.GITHUB_WORKSPACE, getInput('configFile')) | ||
|
||
|
@@ -78,6 +78,10 @@ function getHistoryCommits(from, to) { | |
options.firstParent = true | ||
} | ||
|
||
if (getInput('excludeTargetBranch') === 'true') { | ||
options[`^${GITHUB_BASE_REF}`] = true | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not 100% certain I have the correct variable here since this code has literally never run. (See comment in description about "how to test") |
||
|
||
if (!from) { | ||
options.maxCount = 1 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, the better explanation can go above as well.