diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19e1e0dd..285dcbfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,10 +42,6 @@ jobs: - name: Install dependencies run: composer install --prefer-dist - - name: Coding Standard Checks - if: ${{ matrix.php-versions == '8.0' }} - run: PHP_CS_FIXER_IGNORE_ENV=1 ./bin/php-cs-fixer fix --dry-run --diff - - name: Static Analysis if: ${{ matrix.php-versions == '8.0' }} run: ./bin/psalm.phar --no-cache diff --git a/.github/workflows/cs-fixer.yml b/.github/workflows/cs-fixer.yml new file mode 100644 index 00000000..941faa44 --- /dev/null +++ b/.github/workflows/cs-fixer.yml @@ -0,0 +1,44 @@ +name: PHP CS Fixer + +on: + pull_request: + +permissions: + contents: write + +jobs: + cs-fixer: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + tools: composer:v2.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Cache Composer packages + uses: actions/cache@v5 + with: + path: vendor + key: ${{ runner.os }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-cs-fixer- + + - name: Install dependencies + run: composer install --prefer-dist + + - name: Run PHP CS Fixer + run: ./bin/php-cs-fixer fix --diff + + - name: Commit CS Fixer fixes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "style: apply php-cs-fixer changes" + commit_author: "github-actions[bot] "