aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/autoFix.yml
blob: 010cb2c0aa40653e1df46df23c2d8f0452873c6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: "Auto-Fix code"
on:
  push:
    branches:
      - master

jobs:
  autofix:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'
          tools: phpcbf, rector

      - name: Setup Cache
        uses: actions/cache@v3
        with:
          path: _test/.rector-cache
          key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}

      - name: Run Rector
        run: rector process --config _test/rector.php --no-diffs

      - name: Run PHP CodeSniffer autofixing
        continue-on-error: true # even if not all errors are fixed, we want to create a PR
        run: phpcbf --standard=_test/phpcs_MigrationAdjustments.xml

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          commit-message: "🤖 Rector and PHPCS fixes"
          title: "🤖 Automatic code style fixes"
          body: |
            These changes were made automatically by running rector and phpcbf.

            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.

            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.
          delete-branch: true
          branch: "bot/autofix"