php-cs-fixer.yml 727 B

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