1
0

lint-eslint.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. #
  6. # Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions
  7. # https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
  8. name: Lint eslint
  9. on:
  10. pull_request:
  11. permissions:
  12. contents: read
  13. concurrency:
  14. group: lint-eslint-${{ github.head_ref || github.run_id }}
  15. cancel-in-progress: true
  16. jobs:
  17. changes:
  18. runs-on: ubuntu-latest-low
  19. outputs:
  20. src: ${{ steps.changes.outputs.src}}
  21. steps:
  22. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  23. id: changes
  24. continue-on-error: true
  25. with:
  26. filters: |
  27. src:
  28. - '.github/workflows/**'
  29. - '**/src/**'
  30. - '**/appinfo/info.xml'
  31. - 'package.json'
  32. - 'package-lock.json'
  33. - 'tsconfig.json'
  34. - '.eslintrc.*'
  35. - '.eslintignore'
  36. - '**.js'
  37. - '**.ts'
  38. - '**.vue'
  39. lint:
  40. runs-on: ubuntu-latest
  41. needs: changes
  42. if: needs.changes.outputs.src != 'false'
  43. name: NPM lint
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  47. - name: Read package.json node and npm engines version
  48. uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
  49. id: versions
  50. with:
  51. fallbackNode: '^20'
  52. fallbackNpm: '^9'
  53. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  54. uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
  55. with:
  56. node-version: ${{ steps.versions.outputs.nodeVersion }}
  57. - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
  58. run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
  59. - name: Install dependencies
  60. env:
  61. CYPRESS_INSTALL_BINARY: 0
  62. PUPPETEER_SKIP_DOWNLOAD: true
  63. run: npm ci
  64. - name: Lint
  65. run: npm run lint
  66. summary:
  67. permissions:
  68. contents: none
  69. runs-on: ubuntu-latest-low
  70. needs: [changes, lint]
  71. if: always()
  72. # This is the summary, we just avoid to rename it so that branch protection rules still match
  73. name: eslint
  74. steps:
  75. - name: Summary status
  76. run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi