chengkun
2025-09-04 2e12809f4d16aa00239b5e2c6a13a9a51842d134
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: PHP CS Fixer
 
on:
  pull_request:
    branches:
      - "8.x"
    paths:
      - '**.php'
 
jobs:
  php-cs-fixer:
    runs-on: ubuntu-latest
 
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 10
 
      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
          tools: cs2pr,php-cs-fixer
 
      - name: Run PHP CS Fixer
        run: |
          changed_files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- '*.php')
          for file in $changed_files; do
            php-cs-fixer fix "$file" --dry-run --diff --rules=@PER-CS2.0 --format=checkstyle | cs2pr
          done