Added code-style.yml #1012
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Style | |
| on: | |
| push: | |
| pull_request: | |
| permissions: write-all | |
| jobs: | |
| Check: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: shivammathur/setup-php@v2 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'latest' | |
| - name: Install Composer dependencies | |
| run: composer global require dragon-code/codestyler | |
| - name: Install Node dependencies | |
| run: npm i -D @biomejs/biome | |
| - name: Publish config files | |
| run: | | |
| codestyle pint 8.2 | |
| codestyle npm | |
| - name: PHP code-style | |
| run: pint --parallel --test | |
| - name: Node code-style | |
| run: | | |
| npx @biomejs/biome lint | |
| npx @biomejs/biome format | |
| Fix: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: shivammathur/setup-php@v2 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'latest' | |
| - name: Setup Composer | |
| run: | | |
| composer global config --no-plugins allow-plugins.dragon-code/codestyler true | |
| composer global config --no-plugins allow-plugins.ergebnis/composer-normalize true | |
| composer config --no-plugins allow-plugins.dragon-code/codestyler true | |
| composer config --no-plugins allow-plugins.ergebnis/composer-normalize true | |
| - name: Install Composer dependencies | |
| run: composer global require dragon-code/codestyler | |
| - name: Install Node dependencies | |
| run: npm i -D @biomejs/biome | |
| - name: Publish config files | |
| run: | | |
| codestyle pint 8.2 | |
| codestyle npm | |
| - name: Normalize composer.json | |
| run: composer normalize | |
| - name: PHP code-style | |
| run: pint --parallel | |
| - name: Node code-style | |
| run: | | |
| npx @biomejs/biome lint --write | |
| npx @biomejs/biome format --write | |
| - name: Create a Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| branch: code-style | |
| branch-suffix: random | |
| delete-branch: true | |
| title: "🦋 The code style has been fixed" | |
| commit-message: 🦋 The code style has been fixed | |
| body: The code style has been fixed | |
| labels: code-style |