xref: /dokuwiki/.github/workflows/autoFix.yml (revision 956542d0cb44bb28d8abbc0553980faa0ab1ad54)
1077b7fe2SAndreas Gohrname: "Auto-Fix code"
2077b7fe2SAndreas Gohron:
3077b7fe2SAndreas Gohr  push:
4077b7fe2SAndreas Gohr    branches:
5d6784168SAndreas Gohr      - master
6077b7fe2SAndreas Gohr
7077b7fe2SAndreas Gohrjobs:
8077b7fe2SAndreas Gohr  autofix:
9*956542d0STobias    if: github.repository_owner == 'dokuwiki'
10077b7fe2SAndreas Gohr    runs-on: ubuntu-latest
11077b7fe2SAndreas Gohr    steps:
12077b7fe2SAndreas Gohr      - name: Checkout
134d2a0912SAndreas Gohr        uses: actions/checkout@v4
14077b7fe2SAndreas Gohr        with:
15077b7fe2SAndreas Gohr          fetch-depth: 0
16077b7fe2SAndreas Gohr
17077b7fe2SAndreas Gohr      - name: Setup PHP
18077b7fe2SAndreas Gohr        uses: shivammathur/setup-php@v2
19077b7fe2SAndreas Gohr        with:
20077b7fe2SAndreas Gohr          php-version: '8.2'
214de5c5e9SAndreas Gohr
224de5c5e9SAndreas Gohr      - name: Install tools
234de5c5e9SAndreas Gohr        run: |
244de5c5e9SAndreas Gohr          cd _test
254de5c5e9SAndreas Gohr          composer install --no-interaction --no-progress --no-suggest --prefer-dist
26077b7fe2SAndreas Gohr
27077b7fe2SAndreas Gohr      - name: Setup Cache
28077b7fe2SAndreas Gohr        uses: actions/cache@v3
29077b7fe2SAndreas Gohr        with:
30077b7fe2SAndreas Gohr          path: _test/.rector-cache
31077b7fe2SAndreas Gohr          key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}
32077b7fe2SAndreas Gohr
33077b7fe2SAndreas Gohr      - name: Run Rector
344de5c5e9SAndreas Gohr        run: ./_test/vendor/bin/rector process --config _test/rector.php --no-diffs
35077b7fe2SAndreas Gohr
36077b7fe2SAndreas Gohr      - name: Run PHP CodeSniffer autofixing
37aae5a43eSAndreas Gohr        continue-on-error: true # even if not all errors are fixed, we want to create a PR
384de5c5e9SAndreas Gohr        run: ./_test/vendor/bin/phpcbf --standard=_test/phpcs_MigrationAdjustments.xml
39077b7fe2SAndreas Gohr
40077b7fe2SAndreas Gohr      - name: Create Pull Request
414d2a0912SAndreas Gohr        uses: peter-evans/create-pull-request@v6
42077b7fe2SAndreas Gohr        with:
43bf7ba4d5SAndreas Gohr          commit-message: "�� Rector and PHPCS fixes"
44bf7ba4d5SAndreas Gohr          title: "�� Automatic code style fixes"
45bf7ba4d5SAndreas Gohr          body: |
46bf7ba4d5SAndreas Gohr            These changes were made automatically by running rector and phpcbf.
47bf7ba4d5SAndreas Gohr
48aae5a43eSAndreas Gohr            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.
49bf7ba4d5SAndreas Gohr
50aae5a43eSAndreas Gohr            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.
51077b7fe2SAndreas Gohr          delete-branch: true
52077b7fe2SAndreas Gohr          branch: "bot/autofix"
53