xref: /dokuwiki/.github/workflows/autoFix.yml (revision 4c1ed9da814741b3dfa44d8b656e85cbd71ec064)
1name: "Auto-Fix code"
2on:
3  push:
4    branches:
5      - master
6
7jobs:
8  autofix:
9    runs-on: ubuntu-latest
10    steps:
11      - name: Checkout
12        uses: actions/checkout@v4
13        with:
14          fetch-depth: 0
15
16      - name: Setup PHP
17        uses: shivammathur/setup-php@v2
18        with:
19          php-version: '8.2'
20
21      - name: Install tools
22        run: |
23          cd _test
24          composer install --no-interaction --no-progress --no-suggest --prefer-dist
25
26      - name: Setup Cache
27        uses: actions/cache@v3
28        with:
29          path: _test/.rector-cache
30          key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}
31
32      - name: Run Rector
33        run: ./_test/vendor/bin/rector process --config _test/rector.php --no-diffs
34
35      - name: Run PHP CodeSniffer autofixing
36        continue-on-error: true # even if not all errors are fixed, we want to create a PR
37        run: ./_test/vendor/bin/phpcbf --standard=_test/phpcs_MigrationAdjustments.xml
38
39      - name: Create Pull Request
40        uses: peter-evans/create-pull-request@v6
41        with:
42          commit-message: "�� Rector and PHPCS fixes"
43          title: "�� Automatic code style fixes"
44          body: |
45            These changes were made automatically by running rector and phpcbf.
46
47            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.
48
49            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.
50          delete-branch: true
51          branch: "bot/autofix"
52