linters.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Linters
  2. on:
  3. push:
  4. branches: [main]
  5. paths-ignore:
  6. - '.github/**'
  7. - '!.github/workflows/linters.yml'
  8. - '!.github/CONTRIBUTING.md'
  9. pull_request:
  10. # We want all branches so we configure types to be the GH default again
  11. types: [opened, synchronize, reopened]
  12. paths-ignore:
  13. - '.github/**'
  14. - '!.github/workflows/linters.yml'
  15. - '!.github/CONTRIBUTING.md'
  16. env:
  17. YARN_ENABLE_GLOBAL_CACHE: false
  18. jobs:
  19. lint_js:
  20. name: Lint JavaScript/TypeScript
  21. runs-on: ubuntu-latest
  22. steps:
  23. - name: Checkout sources
  24. uses: actions/checkout@v3
  25. - name: Get yarn cache directory path
  26. id: yarn-cache-dir-path
  27. run:
  28. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  29. - uses: actions/cache@v4
  30. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  31. with:
  32. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  33. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  34. restore-keys: |
  35. ${{ runner.os }}-yarn-
  36. - name: Install Node.js
  37. uses: actions/setup-node@v4
  38. with:
  39. node-version: lts/*
  40. - name: Install dependencies
  41. # List all projects that use a custom ESLint config:
  42. run:
  43. corepack yarn workspaces focus @uppy/angular @uppy-example/angular
  44. @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build
  45. - name: Run linter
  46. run: corepack yarn run lint
  47. - name: Run Prettier
  48. run: corepack yarn run format:check-diff
  49. lint_md:
  50. name: Lint Markdown
  51. runs-on: ubuntu-latest
  52. steps:
  53. - name: Checkout sources
  54. uses: actions/checkout@v3
  55. - name: Get yarn cache directory path
  56. id: yarn-cache-dir-path
  57. run:
  58. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  59. - uses: actions/cache@v4
  60. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  61. with:
  62. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  63. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  64. restore-keys: |
  65. ${{ runner.os }}-yarn-
  66. - name: Install Node.js
  67. uses: actions/setup-node@v4
  68. with:
  69. node-version: lts/*
  70. - name: Install dependencies
  71. run: corepack yarn workspaces focus @uppy-dev/build
  72. - name: Run linter
  73. run: corepack yarn run lint:markdown