|
1 | | -name: "CodeQL Security Scanning" |
| 1 | +name: 'CodeQL Security Scanning' |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ "main" ] |
| 5 | + branches: ['main'] |
6 | 6 | pull_request: |
7 | | - branches: [ "main" ] |
| 7 | + branches: ['main'] |
8 | 8 | schedule: |
9 | | - - cron: '30 1 * * 1' # Weekly on Mondays at 1:30 AM UTC |
| 9 | + - cron: '30 1 * * 1' # Weekly on Mondays at 1:30 AM UTC |
10 | 10 |
|
11 | 11 | jobs: |
| 12 | + yarn: |
| 13 | + name: Check package.json and yarn.lock consistency |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v5 |
| 17 | + - uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version: '22' |
| 20 | + cache: 'yarn' |
| 21 | + |
| 22 | + # Verify lockfile is up-to-date |
| 23 | + - name: Check yarn.lock consistency |
| 24 | + run: | |
| 25 | + echo "Running immutable install to verify yarn.lock..." |
| 26 | + if ! yarn install --immutable; then |
| 27 | + echo "::error::yarn.lock is out of sync with package.json. Run 'yarn install' locally and commit the updated yarn.lock" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
| 31 | + # Run typecheck to catch type errors early |
| 32 | + - name: Type check |
| 33 | + run: yarn typecheck |
| 34 | + |
12 | 35 | analyze: |
13 | 36 | name: Analyze Code |
| 37 | + needs: yarn |
14 | 38 | runs-on: ubuntu-latest |
15 | | - timeout-minutes: 360 |
16 | 39 | permissions: |
17 | 40 | security-events: write |
18 | 41 | packages: read |
19 | 42 | actions: read |
20 | 43 | contents: read |
21 | 44 |
|
22 | 45 | strategy: |
23 | | - fail-fast: false |
| 46 | + fail-fast: true |
24 | 47 | matrix: |
25 | 48 | include: |
26 | | - - language: javascript-typescript |
27 | | - build-mode: autobuild |
28 | | - |
| 49 | + - language: javascript-typescript |
| 50 | + build-mode: autobuild |
| 51 | + |
29 | 52 | steps: |
30 | | - - name: Checkout repository |
31 | | - uses: actions/checkout@v4 |
32 | | - |
33 | | - - name: Initialize CodeQL |
34 | | - uses: github/codeql-action/init@v3 |
35 | | - with: |
36 | | - languages: ${{ matrix.language }} |
37 | | - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs |
38 | | - queries: +security-and-quality |
39 | | - |
40 | | - - name: Setup Node.js |
41 | | - uses: actions/setup-node@v4 |
42 | | - with: |
43 | | - node-version: '22' |
44 | | - cache: 'yarn' |
45 | | - |
46 | | - - name: Install dependencies and build |
47 | | - run: | |
48 | | - yarn install |
49 | | - yarn build |
50 | | -
|
51 | | - - name: Perform CodeQL Analysis |
52 | | - uses: github/codeql-action/analyze@v3 |
53 | | - with: |
54 | | - category: "/language:${{matrix.language}}" |
55 | | - upload: true |
56 | | - ram: 6144 # Increase memory for large codebases |
57 | | - threads: 2 # Number of threads to use for analysis |
58 | | - add-snippets: true # Include code snippets in the results |
| 53 | + - name: Checkout repository |
| 54 | + uses: actions/checkout@v5 |
| 55 | + |
| 56 | + - name: Initialize CodeQL |
| 57 | + uses: github/codeql-action/init@v4 |
| 58 | + with: |
| 59 | + languages: ${{ matrix.language }} |
| 60 | + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs |
| 61 | + queries: +security-and-quality |
| 62 | + |
| 63 | + - name: Setup Node.js |
| 64 | + uses: actions/setup-node@v4 |
| 65 | + with: |
| 66 | + node-version: '22' |
| 67 | + cache: 'yarn' |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: yarn install --immutable |
| 71 | + |
| 72 | + - name: Perform CodeQL Analysis |
| 73 | + uses: github/codeql-action/analyze@v4 |
| 74 | + with: |
| 75 | + category: '/language:${{matrix.language}}' |
0 commit comments