mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
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:
@@ -31,11 +31,29 @@ on:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
compute_matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.supported-version.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./supported-version
|
||||
with:
|
||||
kind: all
|
||||
id: supported-version
|
||||
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
||||
|
||||
coding-standard:
|
||||
needs: compute_matrix
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: './coding-standard'
|
||||
with:
|
||||
version: ${{ github.event.inputs.version || '*' }}
|
||||
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
||||
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
||||
composer_version: ${{ matrix.composer }}
|
||||
php_version: ${{ matrix.php }}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user