1
0

lint-php-cs.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. name: Lint php-cs
  6. on: pull_request
  7. permissions:
  8. contents: read
  9. concurrency:
  10. group: lint-php-cs-${{ github.head_ref || github.run_id }}
  11. cancel-in-progress: true
  12. jobs:
  13. changes:
  14. runs-on: ubuntu-latest
  15. outputs:
  16. src: ${{ steps.changes.outputs.src}}
  17. steps:
  18. - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
  19. id: changes
  20. continue-on-error: true
  21. with:
  22. filters: |
  23. src:
  24. - '.github/workflows/**'
  25. - '3rdparty/**'
  26. - '**/lib/**'
  27. - '**/tests/**'
  28. - '**/vendor-bin/**'
  29. - '.php-cs-fixer.dist.php'
  30. - 'composer.json'
  31. - 'composer.lock'
  32. - '**.php'
  33. lint:
  34. runs-on: ubuntu-latest
  35. name: PHP CS fixer lint
  36. steps:
  37. - name: Checkout
  38. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
  39. - name: Set up php
  40. uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
  41. with:
  42. php-version: 8.1
  43. coverage: none
  44. ini-file: development
  45. env:
  46. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  47. - name: Install dependencies
  48. run: composer i
  49. - name: Lint
  50. run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
  51. summary:
  52. permissions:
  53. contents: none
  54. runs-on: ubuntu-latest
  55. needs: [changes, lint]
  56. if: always()
  57. # This is the summary, we just avoid to rename it so that branch protection rules still match
  58. name: php-cs
  59. steps:
  60. - name: Summary status
  61. run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi