name: PHP Code Style

on: [push, pull_request]

jobs:
    phpcs:
        name: PHP CodeSniffer
        runs-on: ubuntu-latest
        if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
        steps:
            - uses: actions/checkout@v2

            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: '7.4'
                  tools: cs2pr, phpcs

            - name: run PHP codesniffer
              run: phpcs -q --standard=_test/phpcs_MigrationAdjustments.xml --report=checkstyle | cs2pr
