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