From a429c640782fa420842ce302dc81f2a2862154da Mon Sep 17 00:00:00 2001 From: Shane Smith Date: Tue, 24 Nov 2026 03:11:23 +1030 Subject: [PATCH] Check code style with Pint on pull requests Pint is already a dev dependency, but only ran when someone remembered to run it locally. The new Code style workflow runs vendor/bin/pint --test on pull requests and pushes to main, failing with the files it would change. It installs like the Tests workflow, so forks without the plugin credentials still get checked. --- .github/workflows/pint.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/pint.yml diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml new file mode 100644 index 00000000..3d1fa27a --- /dev/null +++ b/.github/workflows/pint.yml @@ -0,0 +1,43 @@ +name: Code style + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + pint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, sodium + coverage: none + + # Pint comes with the dev dependencies. As in the Tests workflow, pull requests from forks get no + # plugin licence credentials, so those install everything but the paid plugin, which Pint doesn't need. + - name: Install Composer dependencies + run: | + if [ -n "$COMPOSER_AUTH" ]; then + composer install --prefer-dist --no-interaction --no-progress + else + echo "No COMPOSER_AUTH secret, so installing without the paid plugin." + composer setup:free --no-interaction + fi + env: + COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} + + # --test changes nothing: it lists the files Pint would change and fails if there are any. + # Run vendor/bin/pint locally to fix them. + - name: Check code style + run: vendor/bin/pint --test