1
0

lint-eslint.yml 2.5 KB

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