xref: /dokuwiki/.github/workflows/autoFix.yml (revision d6784168e25fb8f3f5e63e884cc1412df1533641)
1077b7fe2SAndreas Gohrname: "Auto-Fix code"
2077b7fe2SAndreas Gohron:
3077b7fe2SAndreas Gohr  push:
4077b7fe2SAndreas Gohr    branches:
5*d6784168SAndreas Gohr      - master
6077b7fe2SAndreas Gohr
7077b7fe2SAndreas Gohrjobs:
8077b7fe2SAndreas Gohr  autofix:
9077b7fe2SAndreas Gohr    runs-on: ubuntu-latest
10077b7fe2SAndreas Gohr    steps:
11077b7fe2SAndreas Gohr      - name: Checkout
12077b7fe2SAndreas Gohr        uses: actions/checkout@v3
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'
20077b7fe2SAndreas Gohr          tools: phpcbf, rector
21077b7fe2SAndreas Gohr
22077b7fe2SAndreas Gohr      - name: Setup Cache
23077b7fe2SAndreas Gohr        uses: actions/cache@v3
24077b7fe2SAndreas Gohr        with:
25077b7fe2SAndreas Gohr          path: _test/.rector-cache
26077b7fe2SAndreas Gohr          key: ${{ runner.os }}-rector-${{ hashFiles('_test/rector.php') }}
27077b7fe2SAndreas Gohr
28077b7fe2SAndreas Gohr      - name: Run Rector
29077b7fe2SAndreas Gohr        run: rector process --config _test/rector.php --no-diffs
30077b7fe2SAndreas Gohr
31077b7fe2SAndreas Gohr      - name: Run PHP CodeSniffer autofixing
32077b7fe2SAndreas Gohr        run: phpcbf --standard=_test/phpcs_MigrationAdjustments.xml
33077b7fe2SAndreas Gohr
34077b7fe2SAndreas Gohr      - name: Create Pull Request
35077b7fe2SAndreas Gohr        uses: peter-evans/create-pull-request@v4
36077b7fe2SAndreas Gohr        with:
37bf7ba4d5SAndreas Gohr          commit-message: "�� Rector and PHPCS fixes"
38bf7ba4d5SAndreas Gohr          title: "�� Automatic code style fixes"
39bf7ba4d5SAndreas Gohr          body: |
40bf7ba4d5SAndreas Gohr            These changes were made automatically by running rector and phpcbf.
41bf7ba4d5SAndreas Gohr
42bf7ba4d5SAndreas Gohr            Please carefully check the changes before merging. Please note that
43bf7ba4d5SAndreas Gohr            unit tests are not run for automated pull requests - so if in doubt,
44bf7ba4d5SAndreas Gohr            manually test the branch before merging.
45bf7ba4d5SAndreas Gohr
46bf7ba4d5SAndreas Gohr            If you disagree with the changes, simply clean the code yourself and
47bf7ba4d5SAndreas Gohr            create a new pull request. This PR automatically closes when no more
48bf7ba4d5SAndreas Gohr            changes are suggested by rector and phpcbf.
49077b7fe2SAndreas Gohr          delete-branch: true
50077b7fe2SAndreas Gohr          branch: "bot/autofix"
51