44permissions : write-all
55
66jobs :
7- Check :
7+ php :
8+ name : PHP
89 runs-on : ubuntu-latest
9-
10- if : ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }}
1110
1211 steps :
1312 - uses : actions/checkout@v5
1413 - uses : shivammathur/setup-php@v2
1514
16- - uses : actions/setup-node@v4
17- with :
18- node-version : ' latest'
15+ - name : Can fix detect
16+ id : can_fix
17+ shell : bash
18+ run : |
19+ CAN_FIX: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
20+
21+ echo "enabled=${CAN_FIX}" >> "$GITHUB_OUTPUT"
22+
23+ - name : Setup Composer
24+ run : |
25+ composer global config --no-plugins allow-plugins.laravel/pint true
26+ composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true
27+
28+ composer config --no-plugins allow-plugins.laravel/pint true
29+ composer config --no-plugins allow-plugins.ergebnis/composer-normalize true
1930
2031 - name : Install Composer dependencies
2132 run : composer global require dragon-code/codestyler
2233
23- - name : Install Node dependencies
24- run : npm i -D @biomejs/biome
25-
2634 - name : Publish config files
27- run : |
28- codestyle pint 8.2
29- codestyle npm
35+ run : codestyle pint 8.2
3036
31- - name : PHP code-style
32- run : pint --parallel --test
37+ - name : Normalize composer.json
38+ if : ${{ steps.can_fix.outputs.enabled == '1' }}
39+ run : composer normalize
3340
34- - name : Node code-style
35- run : |
36- npx @biomejs/biome lint
37- npx @biomejs/biome format
41+ - name : Fix PHP code-style
42+ if : ${{ steps.can_fix.outputs.enabled == '1' }}
43+ run : pint --parallel
3844
39- Fix :
45+ - name : Check PHP code-style
46+ if : ${{ steps.can_fix.outputs.enabled == '0' }}
47+ run : pint --parallel --test
48+
49+ node :
50+ name : Node
4051 runs-on : ubuntu-latest
41-
42- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4352
4453 steps :
4554 - uses : actions/checkout@v5
4958 with :
5059 node-version : ' latest'
5160
61+ - name : Can fix detect
62+ id : can_fix
63+ shell : bash
64+ run : |
65+ CAN_FIX: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
66+
67+ echo "enabled=${CAN_FIX}" >> "$GITHUB_OUTPUT"
68+
5269 - name : Detect package.json
5370 id : has_pkg
5471 shell : bash
@@ -59,37 +76,29 @@ jobs:
5976 echo "HAS_PACKAGE_JSON=0" >> "$GITHUB_ENV"
6077 fi
6178
62- - name : Setup Composer
63- run : |
64- composer global config --no-plugins allow-plugins.laravel/pint true
65- composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true
66-
67- composer config --no-plugins allow-plugins.laravel/pint true
68- composer config --no-plugins allow-plugins.ergebnis/composer-normalize true
69-
7079 - name : Install Composer dependencies
7180 run : composer global require dragon-code/codestyler
7281
7382 - name : Install Node dependencies
7483 run : npm i -D @biomejs/biome
7584
7685 - name : Publish config files
77- run : |
78- codestyle pint 8.2
79- codestyle npm
80-
81- - name : Normalize composer.json
82- run : composer normalize
83-
84- - name : PHP code-style
85- run : pint --parallel
86+ run : codestyle npm
8687
8788 - name : Node code-style
89+ if : ${{ steps.can_fix.outputs.enabled == '1' }}
8890 run : |
8991 npx @biomejs/biome lint --write
9092 npx @biomejs/biome format --write
9193
94+ - name : Node code-style
95+ if : ${{ steps.can_fix.outputs.enabled == '0' }}
96+ run : |
97+ npx @biomejs/biome lint
98+ npx @biomejs/biome format
99+
92100 - name : Remove node_modules
101+ if : ${{ steps.can_fix.outputs.enabled == '1' }}
93102 run : rm -rf node_modules
94103
95104 - name : Remove package.json
@@ -98,6 +107,19 @@ jobs:
98107 rm package.json
99108 rm package-lock.json
100109
110+ pr :
111+ needs :
112+ - php
113+ - node
114+
115+ name : Create a PR
116+ runs-on : ubuntu-latest
117+
118+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
119+
120+ steps :
121+ - uses : actions/checkout@v5
122+
101123 - name : Create a Pull Request
102124 uses : peter-evans/create-pull-request@v7
103125 with :
0 commit comments