diff --git a/action.yml b/action.yml index 9655516..cc1ef9c 100644 --- a/action.yml +++ b/action.yml @@ -55,10 +55,10 @@ inputs: default: ${{ github.event.pull_request.head.sha }} required: false - pull_request_base: - description: "The commit right before the pull-request commits (intenral)" - default: ${{ github.event.pull_request.base.sha }} - required: true + pull_request_commits: + description: "Number of commits in this PR" + required: false + default: ${{ github.event.commits }} outputs: sarif: diff --git a/container/cmd b/container/cmd index 72bde58..4b2b4f5 100755 --- a/container/cmd +++ b/container/cmd @@ -42,7 +42,6 @@ set_linter_options() for tag in $INPUT_LINTER_TAGS; do linter_options+=( --linter-tag "$tag" ) done - linter_options+=( --compare-against "$INPUT_PULL_REQUEST_BASE" ) } populate_sarif_data() @@ -89,6 +88,10 @@ if test "$GITHUB_EVENT_NAME" = 'pull_request'; then # We don't want to rebase on top of the current upstream's head; the line # numbers would be shifted and the provided output would be misleading. + # Get the last commit before this PR. + last_committed=$(git rev-parse "HEAD~$INPUT_PULL_REQUEST_COMMITS") + linter_options+=( --compare-against "$last_committed" ) + test -z "$INPUT_SUBDIRECTORY" || INPUT_SUBDIRECTORIES=$INPUT_SUBDIRECTORY test -z "$INPUT_SUBDIRECTORIES" && INPUT_SUBDIRECTORIES=.