xref: /dokuwiki/.github/workflows/autoFix.yml (revision cf94d96c58acd995ff784a30a45529ae203c7d57)
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@v3
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          tools: phpcbf, rector
21
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') }}
27
28      - name: Run Rector
29        run: rector process --config _test/rector.php --no-diffs
30
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
34
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.
42
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.
44
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"
48