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