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-low
  15. outputs:
  16. src: ${{ steps.changes.outputs.src}}
  17. steps:
  18. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  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@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
  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-low
  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