php-cs-fixer.yml 772 B

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