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