name: PHP coding standards on: push: branches: - main pull_request: branches: - main workflow_dispatch: # Cancels all previous workflow runs for pull requests that have not completed. concurrency: # The concurrency group contains the workflow name and the branch name for pull requests # or the commit hash for any other events. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true # Disable permissions for all available scopes by default. # Any needed permissions should be configured at the job level. permissions: {} jobs: # Runs the PHP coding standards checks. # # Violations are reported inline with annotations. # # Performs the following steps: # - Checks out the repository. # - Sets up PHP. # - Installs Composer dependencies. # - Make Composer packages available globally. # - Runs PHPCS on the full codebase (warnings excluded). # - Ensures version-controlled files are not modified or deleted. phpcs: name: Run coding standards checks runs-on: ubuntu-latest permissions: contents: read timeout-minutes: 20 steps: - name: Checkout repository uses: actions/checkout@v4 with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - name: Set up PHP uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0 with: coverage: none - name: Install Composer dependencies uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1 - name: Make Composer packages available globally run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH - name: Run PHPCS on all files id: phpcs-files run: phpcs . -n --report-full - name: Ensure version-controlled files are not modified during the checks run: git diff --exit-code