autofix: create PR even if phpcbf can't fix everything
[dokuwiki.git] / .github / workflows / autoFix.yml
blob010cb2c0aa40653e1df46df23c2d8f0452873c6a
1 name: "Auto-Fix code"
2 on:
3   push:
4     branches:
5       - master
7 jobs:
8   autofix:
9     runs-on: ubuntu-latest
10     steps:
11       - name: Checkout
12         uses: actions/checkout@v3
13         with:
14           fetch-depth: 0
16       - name: Setup PHP
17         uses: shivammathur/setup-php@v2
18         with:
19           php-version: '8.2'
20           tools: phpcbf, rector
22       - name: Setup Cache
23         uses: actions/cache@v3
24         with:
25           path: _test/.rector-cache
26           key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}
28       - name: Run Rector
29         run: rector process --config _test/rector.php --no-diffs
31       - name: Run PHP CodeSniffer autofixing
32         continue-on-error: true # even if not all errors are fixed, we want to create a PR
33         run: phpcbf --standard=_test/phpcs_MigrationAdjustments.xml
35       - name: Create Pull Request
36         uses: peter-evans/create-pull-request@v4
37         with:
38           commit-message: "🤖 Rector and PHPCS fixes"
39           title: "🤖 Automatic code style fixes"
40           body: |
41             These changes were made automatically by running rector and phpcbf.
43             Please carefully check the changes before merging. Please note that unit tests are not run for automated pull requests - so if in doubt, manually test the branch before merging.
45             If you disagree with the changes, simply clean the code yourself and create a new pull request. This PR automatically closes when no more changes are suggested by rector and phpcbf.
46           delete-branch: true
47           branch: "bot/autofix"