|
| 1 | +name: Code Style |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +permissions: write-all |
| 8 | + |
| 9 | +jobs: |
| 10 | + Check: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v5 |
| 17 | + - uses: shivammathur/setup-php@v2 |
| 18 | + |
| 19 | + - uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: 'latest' |
| 22 | + |
| 23 | + - name: Install Composer dependencies |
| 24 | + run: composer global require dragon-code/codestyler |
| 25 | + |
| 26 | + - name: Install Node dependencies |
| 27 | + run: npm i -D @biomejs/biome |
| 28 | + |
| 29 | + - name: Publish config files |
| 30 | + run: | |
| 31 | + codestyle pint 8.2 |
| 32 | + codestyle npm |
| 33 | +
|
| 34 | + - name: PHP code-style |
| 35 | + run: pint --parallel --test |
| 36 | + |
| 37 | + - name: Node code-style |
| 38 | + run: | |
| 39 | + npx @biomejs/biome lint |
| 40 | + npx @biomejs/biome format |
| 41 | +
|
| 42 | + Fix: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + |
| 45 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 46 | + |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v5 |
| 49 | + - uses: shivammathur/setup-php@v2 |
| 50 | + |
| 51 | + - uses: actions/setup-node@v4 |
| 52 | + with: |
| 53 | + node-version: 'latest' |
| 54 | + |
| 55 | + - name: Setup Composer |
| 56 | + run: | |
| 57 | + composer global config --no-plugins allow-plugins.dragon-code/codestyler true |
| 58 | + composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true |
| 59 | + |
| 60 | + composer config --no-plugins allow-plugins.dragon-code/codestyler true |
| 61 | + composer config --no-plugins allow-plugins.ergebnis/composer-normalize true |
| 62 | +
|
| 63 | + - name: Install Composer dependencies |
| 64 | + run: composer global require dragon-code/codestyler |
| 65 | + |
| 66 | + - name: Install Node dependencies |
| 67 | + run: npm i -D @biomejs/biome |
| 68 | + |
| 69 | + - name: Publish config files |
| 70 | + run: | |
| 71 | + codestyle pint 8.2 |
| 72 | + codestyle npm |
| 73 | +
|
| 74 | + - name: Normalize composer.json |
| 75 | + run: composer normalize |
| 76 | + |
| 77 | + - name: PHP code-style |
| 78 | + run: pint --parallel |
| 79 | + |
| 80 | + - name: Node code-style |
| 81 | + run: | |
| 82 | + npx @biomejs/biome lint --write |
| 83 | + npx @biomejs/biome format --write |
| 84 | +
|
| 85 | + - name: Create a Pull Request |
| 86 | + uses: peter-evans/create-pull-request@v7 |
| 87 | + with: |
| 88 | + branch: code-style |
| 89 | + branch-suffix: random |
| 90 | + delete-branch: true |
| 91 | + title: "🦋 The code style has been fixed" |
| 92 | + commit-message: 🦋 The code style has been fixed |
| 93 | + body: The code style has been fixed |
| 94 | + labels: code-style |
0 commit comments