|
1 | 1 | on: |
2 | 2 | workflow_call: |
3 | 3 |
|
| 4 | +permissions: write-all |
| 5 | + |
4 | 6 | jobs: |
5 | | - check: |
| 7 | + Check: |
6 | 8 | runs-on: ubuntu-latest |
7 | 9 |
|
8 | 10 | if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} |
9 | 11 |
|
10 | | - name: Check |
11 | | - |
12 | 12 | steps: |
13 | | - - name: Checkout code |
14 | | - uses: actions/checkout@v5 |
| 13 | + - uses: actions/checkout@v5 |
| 14 | + - uses: shivammathur/setup-php@v2 |
15 | 15 |
|
16 | | - - name: Setup PHP |
17 | | - uses: shivammathur/setup-php@v2 |
| 16 | + - uses: actions/setup-node@v4 |
18 | 17 | with: |
19 | | - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json |
20 | | - coverage: none |
| 18 | + node-version: 'latest' |
| 19 | + |
| 20 | + - name: Install Composer dependencies |
| 21 | + run: composer global require dragon-code/codestyler |
| 22 | + |
| 23 | + - name: Install Node dependencies |
| 24 | + run: npm i -D @biomejs/biome |
21 | 25 |
|
22 | | - - name: Install dependency |
23 | | - run: composer global require dragon-code/codestyler:^5.0 |
| 26 | + - name: Publish config files |
| 27 | + run: | |
| 28 | + codestyle pint 8.2 |
| 29 | + codestyle npm |
| 30 | +
|
| 31 | + - name: PHP code-style |
| 32 | + run: pint --parallel --test |
24 | 33 |
|
25 | | - - name: Check the code-style |
26 | | - run: codestyle --test |
| 34 | + - name: Node code-style |
| 35 | + run: | |
| 36 | + npx @biomejs/biome lint |
| 37 | + npx @biomejs/biome format |
27 | 38 |
|
28 | | - fix: |
| 39 | + Fix: |
29 | 40 | runs-on: ubuntu-latest |
30 | 41 |
|
31 | 42 | if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
32 | 43 |
|
33 | | - name: Fix |
34 | | - |
35 | 44 | steps: |
36 | | - - name: Checkout code |
37 | | - uses: actions/checkout@v5 |
| 45 | + - uses: actions/checkout@v5 |
| 46 | + - uses: shivammathur/setup-php@v2 |
38 | 47 |
|
39 | | - - name: Setup PHP |
40 | | - uses: shivammathur/setup-php@v2 |
| 48 | + - uses: actions/setup-node@v4 |
41 | 49 | with: |
42 | | - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json |
43 | | - coverage: none |
| 50 | + node-version: 'latest' |
| 51 | + |
| 52 | + - name: Detect package.json |
| 53 | + id: has_pkg |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + if [ -f package.json ]; then |
| 57 | + echo "HAS_PACKAGE_JSON=1" >> "$GITHUB_ENV" |
| 58 | + else |
| 59 | + echo "HAS_PACKAGE_JSON=0" >> "$GITHUB_ENV" |
| 60 | + fi |
44 | 61 |
|
45 | 62 | - name: Setup Composer |
46 | 63 | run: | |
47 | | - composer global config --no-plugins allow-plugins.dragon-code/codestyler true |
| 64 | + composer global config --no-plugins allow-plugins.laravel/pint true |
48 | 65 | composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true |
49 | 66 | |
50 | | - composer config --no-plugins allow-plugins.dragon-code/codestyler true |
| 67 | + composer config --no-plugins allow-plugins.laravel/pint true |
51 | 68 | composer config --no-plugins allow-plugins.ergebnis/composer-normalize true |
52 | 69 |
|
53 | | - - name: Install dependencies |
| 70 | + - name: Install Composer dependencies |
| 71 | + run: composer global require dragon-code/codestyler |
| 72 | + |
| 73 | + - name: Install Node dependencies |
| 74 | + run: npm i -D @biomejs/biome |
| 75 | + |
| 76 | + - name: Publish config files |
54 | 77 | run: | |
55 | | - composer global require dragon-code/codestyler:^5.0 |
56 | | - composer global require ergebnis/composer-normalize |
| 78 | + codestyle pint 8.2 |
| 79 | + codestyle npm |
57 | 80 |
|
58 | | - - name: Fix the code-style |
| 81 | + - name: Normalize composer.json |
| 82 | + run: composer normalize |
| 83 | + |
| 84 | + - name: PHP code-style |
| 85 | + run: pint --parallel |
| 86 | + |
| 87 | + - name: Node code-style |
59 | 88 | run: | |
60 | | - codestyle dependabot |
61 | | - codestyle editorconfig |
62 | | - codestyle |
| 89 | + npx @biomejs/biome lint --write |
| 90 | + npx @biomejs/biome format --write |
| 91 | +
|
| 92 | + - name: Remove node_modules |
| 93 | + run: rm -rf node_modules |
63 | 94 |
|
64 | | - composer normalize |
| 95 | + - name: Remove package.json |
| 96 | + if: ${{ env.HAS_PACKAGE_JSON == '0' }} |
| 97 | + run: rm package.json |
65 | 98 |
|
66 | 99 | - name: Create a Pull Request |
67 | 100 | uses: peter-evans/create-pull-request@v7 |
|
0 commit comments