Update tools, fix cs (#617) #126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check | |
| on: | |
| push: | |
| branches: [main, bugfix, temp] | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| env: | |
| writable: ${{ github.event_name != 'push' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && 1 || 0 }} | |
| jobs: | |
| rexlint: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.1 | |
| coverage: none # disable xdebug, pcov | |
| - name: Composer install | |
| uses: ramsey/composer-install@v3 | |
| - name: Run rexlint | |
| run: vendor/bin/rexlint | |
| php-cs-fixer: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| if: env.writable == 1 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.BOT_TOKEN }} | |
| - name: Checkout fork | |
| uses: actions/checkout@v4 | |
| if: env.writable == 0 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.1 | |
| coverage: none # disable xdebug, pcov | |
| tools: cs2pr | |
| - name: Composer install | |
| uses: ramsey/composer-install@v3 | |
| - name: Fix code style | |
| if: env.writable == 1 | |
| run: vendor/bin/php-cs-fixer list-files --config=.php-cs-fixer.dist.php | xargs -n 250 -P 3 vendor/bin/php-cs-fixer fix --diff --config=.php-cs-fixer.dist.php | |
| - name: Commit changed files | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| if: env.writable == 1 | |
| with: | |
| commit_message: Apply php-cs-fixer changes | |
| commit_user_name: rex-bot | |
| commit_user_email: rex-bot@users.noreply.github.com | |
| - name: Check code style | |
| if: env.writable == 0 | |
| run: vendor/bin/php-cs-fixer fix --ansi --diff --dry-run --format=checkstyle | cs2pr | |