From 48f5808046423e29eb74deccd76e6626cb1d4735 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Thu, 9 Nov 2023 07:55:05 +0100 Subject: [PATCH] feature: pr_modified_files_only flag (#8) flag to limit analysis to modified files closes #6 --- README.md | 1 + action.yml | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e8c08ad..d6a518e 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ jobs: | `ignore_errors_on_exit` | 0 | Ignoring errors when generating the exit code when set to `1` | | `ignore_warnings_on_exit` | 0 | Ignoring warnings when generating the exit code when set to `1` | | `ignore` | no value | A comma separated list of patterns to ignore files and directories | +| `pr_modified_files_only` | "true" | Restricts analysis to modified files in a pull request | See [action.yml](./action.yml). diff --git a/action.yml b/action.yml index ac5c8e8..7a1511c 100644 --- a/action.yml +++ b/action.yml @@ -59,6 +59,10 @@ inputs: ignore: description: "A comma separated list of patterns to ignore files and directories" required: false + pr_modified_files_only: + description: "Restricts analysis to modified files in a pull request" + required: false + default: true runs: using: "composite" steps: @@ -68,7 +72,7 @@ runs: GITHUB_TOKEN: ${{ github.token }} INPUT_CODING_STANDARD_PACKAGE: ${{ inputs.coding_standard_package }} INPUT_CODING_STANDARD_VERSION: ${{ inputs.coding_standard_version }} - if: ${{ inputs.install_coding_standard }} + if: inputs.install_coding_standard run: ${{ github.action_path }}/src/install_coding_standard.bash - name: Check if phpcs exists shell: bash @@ -81,7 +85,7 @@ runs: shell: bash id: pr-files run: echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT - if: github.event_name == 'pull_request' + if: inputs.pr_modified_files_only && github.event_name == 'pull_request' - name: Running coding standard analysis shell: bash run: ${{ github.action_path }}/src/run_coding_standard.bash