Skip to content

chore: Fix PHP linting errors for previews plugin and setup automated code quality #2

chore: Fix PHP linting errors for previews plugin and setup automated code quality

chore: Fix PHP linting errors for previews plugin and setup automated code quality #2

Workflow file for this run

name: Code Quality
on:
pull_request:
paths:
- 'plugins/**'
jobs:
run:
runs-on: ubuntu-latest
name: Check code quality
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed plugin directory
id: plugin
run: |
git fetch --prune --unshallow
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
echo "slug=$plugin" >> $GITHUB_OUTPUT
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
working-directory: plugins/${{ steps.plugin.outputs.slug }}
composer-options: "--no-progress"
- name: Run PHPStan
working-directory: plugins/${{ steps.plugin.outputs.slug }}
run: composer run-script phpstan
- name: Run Psalm
working-directory: plugins/${{ steps.plugin.outputs.slug }}
run: composer run-script php:psalm
- name: Run PHP CodeSniffer
working-directory: plugins/${{ steps.plugin.outputs.slug }}
run: composer run-script check-cs