feat(coding-standard): add ignore_warnings flag (#147)

By default, `phpcs` exits with a non-zero exit code when it finds warnings. We keep that default, but allow changing it.

Co-authored-by: Vitaliy Golomoziy <vitaliy.golomoziy@gmail.com>
This commit is contained in:
Damien Retzinger
2023-09-21 08:40:58 -04:00
committed by GitHub
parent 01e4ccbc54
commit 4e21b18ee9
2 changed files with 47 additions and 1 deletions
+28
View File
@@ -37,6 +37,11 @@ inputs:
default: ""
description: "The minimum severity required to display an error"
ignore_warnings:
description: 'Whether or not the action should fail on warnings, defaults to false (fails on warnings)'
default: 'false'
required: false
runs:
using: composite
steps:
@@ -57,6 +62,23 @@ runs:
tools: composer:v${{ inputs.composer_version }}
coverage: none
- name: Get Composer Version
uses: mage-os/github-actions/get-composer-version@main
id: get-composer-version
- name: Check if allow-plugins option is available for this version of composer
uses: mage-os/github-actions/semver-compare@main
with:
version: 2.2
compare_against: ${{ steps.get-composer-version.outputs.version }}
id: is-allow-plugins-available
- name: Enable dealerdirect/phpcodesniffer-composer-installer plugin
shell: bash
working-directory: standard
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
if: steps.is-allow-plugins-available.outputs.result < 1
- name: Install Coding Standard
shell: bash
working-directory: standard
@@ -67,6 +89,12 @@ runs:
working-directory: standard
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/standard/vendor/magento/magento-coding-standard,${{ github.workspace }}/standard/vendor/phpcompatibility/php-compatibility
- name: Set ignore warnings flag
shell: bash
working-directory: standard
run: vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
if: inputs.ignore_warnings == 'true'
- name: Get Changed Files
shell: bash
working-directory: project