feat(coding-standard): skip composer install if the coding is already installed

This commit is contained in:
Damien Retzinger
2026-04-27 14:03:49 -04:00
parent 3fad3a8995
commit e1a8a81488
+16 -1
View File
@@ -40,13 +40,26 @@ inputs:
runs:
using: composite
steps:
- name: Check if Coding Standard is already installed
id: check-installed
shell: bash
working-directory: ${{ inputs.path }}
run: |
if [ -d "vendor/magento/magento-coding-standard" ] || [ -d "vendor/mage-os/magento-coding-standard" ]; then
echo "installed=true" >> $GITHUB_OUTPUT
else
echo "installed=false" >> $GITHUB_OUTPUT
fi
- name: Get Composer Version
uses: graycoreio/github-actions-magento2/get-composer-version@main
id: get-composer-version
if: steps.check-installed.outputs.installed != 'true'
- name: Check if allow-plugins option is available for this version of composer
uses: graycoreio/github-actions-magento2/semver-compare@main
id: is-allow-plugins-available
if: steps.check-installed.outputs.installed != 'true'
with:
version: 2.2
compare_against: ${{ steps.get-composer-version.outputs.version }}
@@ -55,12 +68,13 @@ runs:
shell: bash
working-directory: ${{ inputs.path }}
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
if: steps.is-allow-plugins-available.outputs.result < 1
if: steps.check-installed.outputs.installed != 'true' && steps.is-allow-plugins-available.outputs.result < 1
- name: Install Coding Standard
shell: bash
working-directory: ${{ inputs.path }}
run: composer require "magento/magento-coding-standard:${{ inputs.version || '*' }}" "magento/php-compatibility-fork"
if: steps.check-installed.outputs.installed != 'true'
env:
COMPOSER_AUTH: ${{ inputs.composer_auth }}
@@ -79,6 +93,7 @@ runs:
fi
vendor/bin/phpcs --config-set installed_paths \
"vendor/${CODING_STANDARD_VENDOR}/magento-coding-standard,vendor/${CODING_STANDARD_VENDOR}/php-compatibility-fork"
if: steps.check-installed.outputs.installed != 'true'
- name: Set ignore warnings flag
shell: bash