lint-and-analyze.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. name: "Lint and Analyze Code"
  2. on:
  3. push:
  4. branches: [main, develop]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. lint:
  9. name: Lint Code
  10. runs-on: ubuntu-latest
  11. strategy:
  12. matrix:
  13. node-version: [22.x]
  14. env:
  15. CI: "true"
  16. STORE_PATH: ""
  17. PNPM_VERSION: 9
  18. RETENTION_DAYS: 2
  19. steps:
  20. - name: Checkout code
  21. uses: actions/checkout@v4
  22. - name: Setup Node.js v${{ matrix.node-version }}
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version: ${{ matrix.node-version }}
  26. - name: Setup pnpm
  27. uses: pnpm/action-setup@v4
  28. with:
  29. version: ${{ env.PNPM_VERSION }}
  30. run_install: false
  31. - name: Get pnpm store directory
  32. shell: bash
  33. run: |
  34. echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  35. - name: Setup pnpm cache
  36. uses: actions/cache@v4
  37. with:
  38. path: ${{ env.STORE_PATH }}
  39. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  40. restore-keys: |
  41. ${{ runner.os }}-pnpm-store-
  42. - name: Install dependencies
  43. run: pnpm i
  44. - name: Lint
  45. run: npm run lint
  46. analyze:
  47. name: Analyze Code
  48. runs-on: ubuntu-latest
  49. permissions:
  50. actions: read
  51. contents: read
  52. security-events: write
  53. strategy:
  54. matrix:
  55. language: ["javascript-typescript"]
  56. # CodeQL supports "c-cpp", "csharp", "go", "java-kotlin", "javascript-typescript", "python", "ruby", "swift"
  57. # Learn more:
  58. # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
  59. steps:
  60. - uses: actions/checkout@v4
  61. with:
  62. submodules: recursive
  63. - name: Initialize CodeQL
  64. uses: github/codeql-action/init@v3
  65. with:
  66. languages: ${{ matrix.language }}
  67. - name: Perform CodeQL Analysis
  68. uses: github/codeql-action/analyze@v3