From 0501a1a7d543e4268f4409579fab25eaf201311b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCnch?= Date: Sat, 27 Apr 2024 15:46:21 +0200 Subject: [PATCH] Move php-cs-fixer checks to own workflow --- .github/workflows/magento_platform_tests.yml | 3 -- .github/workflows/php-code-style.yml | 40 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/php-code-style.yml diff --git a/.github/workflows/magento_platform_tests.yml b/.github/workflows/magento_platform_tests.yml index 6041b664..6112c5b1 100644 --- a/.github/workflows/magento_platform_tests.yml +++ b/.github/workflows/magento_platform_tests.yml @@ -242,9 +242,6 @@ jobs: # everything from scratch for every new branch. run: composer install --no-interaction --prefer-dist --no-progress --no-suggest - - name: Run php-cs-fixer - run: vendor/bin/php-cs-fixer fix --diff --dry-run - - name: Setup Magento Open Source Repository Credentials run: | composer global config http-basic.repo.magento.com "${MAGENTO_MARKETPLACE_USERNAME}" "${MAGENTO_MARKETPLACE_PASSWORD}"; diff --git a/.github/workflows/php-code-style.yml b/.github/workflows/php-code-style.yml new file mode 100644 index 00000000..557a72a2 --- /dev/null +++ b/.github/workflows/php-code-style.yml @@ -0,0 +1,40 @@ +--- +name: Code Style +on: + push: + paths: + - "src/**" + pull_request: + paths: + - "src/**" + +jobs: + php-cs-fixer: + name: PHP CS Fixer + runs-on: ubuntu-latest + steps: + - name: Checkout PR + uses: actions/checkout@v4.1.4 + if: github.event_name == 'pull_request' + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Checkout HEAD + uses: actions/checkout@v4.1.4 + if: github.event_name == 'push' + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + tools: composer:2.2.17, cs2pr + php-version: 8.2 + extensions: mcrypt, mbstring, intl + coverage: none + - name: Install dependencies + # If we have a very broad restore-keys in the previous caching action, + # we might pull outdated dependencies from a parent branch for new branches. + # Over time, just running composer all the time to give it a chance + # to fix the outdated dependencies should be faster than having to pull + # everything from scratch for every new branch. + run: composer install --no-interaction --prefer-dist --no-progress --no-suggest + + - name: Run php-cs-fixer + run: vendor/bin/php-cs-fixer fix --diff --dry-run