diff --git a/coding-standard/README.md b/coding-standard/README.md index 68b789d5..57e667da 100644 --- a/coding-standard/README.md +++ b/coding-standard/README.md @@ -27,4 +27,7 @@ jobs: with: version: 25 # Optional, will use the latest if omitted. path: app/code # Optional, will be used when event is not a pull request. + severity: 8 # Optional, will use phpcs default of 5 if not specified. + warning_severity: 4 # Optional, will use severity value if not specified. + error_severity: 7 # Optional, will use severity value if not specified. ``` diff --git a/coding-standard/action.yml b/coding-standard/action.yml index 1ce6776e..eb5ba35c 100644 --- a/coding-standard/action.yml +++ b/coding-standard/action.yml @@ -21,6 +21,21 @@ inputs: version: required: false description: "The version of the coding standard to use. If not provided, will use the latest version." + + severity: + required: false + default: "" + description: "The minimum severity required to display an error or warning (default: 5)" + + warning_severity: + required: false + default: "" + description: "The minimum severity required to display a warning" + + error_severity: + required: false + default: "" + description: "The minimum severity required to display an error" runs: using: composite @@ -61,5 +76,10 @@ runs: - name: Coding Standard Check shell: bash - run: ../standard/vendor/bin/phpcs --standard=Magento2 ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.files || inputs.path }} + run: | + ../standard/vendor/bin/phpcs --standard=Magento2 \ + $([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \ + $([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \ + $([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \ + ${{ github.event_name == 'pull_request' && steps.changed-files.outputs.files || inputs.path }} working-directory: project