PHP 8.1 erfordern, Code-Modernisierung, rexstan #53
Workflow file for this run
This file contains 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: Code Style | |
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: | |
php-cs-fixer: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
if: env.writable == 1 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Checkout fork | |
uses: actions/checkout@v2 | |
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@v2 | |
with: | |
composer-options: --ansi --prefer-dist | |
- 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@v4 | |
if: env.writable == 1 | |
with: | |
commit_message: Apply php-cs-fixer changes | |
commit_user_name: rex-bot | |
commit_user_email: [email protected] | |
- name: Check code style | |
if: env.writable == 0 | |
run: vendor/bin/php-cs-fixer fix --ansi --diff --dry-run --format=checkstyle | cs2pr # check whether there are still errors left |