name: PHP Lint (Pint)
on: [ push, pull_request ]
jobs:
    pint:
        strategy:
            matrix:
                operating-system:
                    - ubuntu-22.04
                php-version:
                    - '8.4'
                    - '8.5'
        name: php ${{ matrix.php-version }} on ${{ matrix.operating-system }}
        runs-on: ${{ matrix.operating-system }}
        steps:
            -   name: Checkout
                uses: actions/checkout@v6
                with:
                    fetch-depth: 0
            -   name: Setup PHP
                uses: shivammathur/setup-php@v2
                with:
                    php-version: ${{ matrix.php-version }}
                    extensions: curl, dom, gd, libxml, mbstring, zip, mysql, xml, intl, bcmath, redis-phpredis/phpredis@6.0.1
                    ini-values: error_reporting=E_ALL
                    coverage: pcov
                    tools: composer:v2
                env:
                    REDIS_CONFIGURE_OPTS: --enable-redis
            -   name: Install Composer Dependencies
                env:
                    COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
                run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --optimize-autoloader
            -   name: Run Pint
                run: ./vendor/bin/pint -v
            -   name: Commit Changes
                uses: stefanzweifel/git-auto-commit-action@v7
                with:
                    commit_message: "automation: laravel pint ci"
                    commit_user_name: unit3d-bot
                    commit_user_email: unit3d_gh_bot@protonmail.com
                    commit_author: unit3d-bot <unit3d_gh_bot@protonmail.com>
