|
1 | | -name: "Code scanning - action" |
| 1 | +name: "CodeQL Code Scanning" |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
| 5 | + branches: |
| 6 | + - next |
| 7 | + - main |
5 | 8 | pull_request: |
| 9 | + branches: |
| 10 | + - next |
| 11 | + - main |
6 | 12 | schedule: |
7 | | - - cron: '0 16 * * 6' |
| 13 | + - cron: '0 2 * * 1-5' # run at 2 AM UTC Monday through Friday |
8 | 14 |
|
9 | 15 | jobs: |
10 | | - CodeQL-Build: |
11 | | - |
| 16 | + analyze: |
| 17 | + name: Analyze (${{ matrix.language }}) |
12 | 18 | runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + security-events: write # Required for uploading SARIF results |
| 21 | + contents: read # Required for private repos |
| 22 | + actions: read # Required for analyzing workflow files |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + # Analyze Go and JavaScript/TypeScript separately for better performance |
| 28 | + language: ['go', 'javascript-typescript'] |
13 | 29 |
|
14 | 30 | steps: |
15 | 31 | - name: Checkout repository |
16 | 32 | uses: actions/checkout@v5 |
17 | | - with: |
18 | | - # We must fetch at least the immediate parents so that if this is |
19 | | - # a pull request then we can checkout the head. |
20 | | - fetch-depth: 2 |
21 | 33 |
|
22 | | - # If this run was triggered by a pull request event, then checkout |
23 | | - # the head of the pull request instead of the merge commit. |
24 | | - - run: git checkout HEAD^2 |
25 | | - if: ${{ github.event_name == 'pull_request' }} |
26 | | - |
27 | | - # Initializes the CodeQL tools for scanning. |
28 | 34 | - name: Initialize CodeQL |
29 | | - uses: github/codeql-action/init@v3 |
30 | | - # Override language selection by uncommenting this and choosing your languages |
31 | | - # with: |
32 | | - # languages: go, javascript, csharp, python, cpp, java |
33 | | - |
34 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
35 | | - # If this step fails, then you should remove it and run the build manually (see below) |
36 | | - #- name: Autobuild |
37 | | - # uses: github/codeql-action/autobuild@v1 |
38 | | - |
39 | | - # ℹ️ Command-line programs to run using the OS shell. |
40 | | - # 📚 https://git.io/JvXDl |
41 | | - |
42 | | - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines |
43 | | - # and modify them (or add more) to build your code if your project |
44 | | - # uses a compiled language |
45 | | - |
46 | | - #- run: | |
47 | | - # make bootstrap |
48 | | - # make release |
49 | | - |
50 | | - # to make sure autobuild success, specifify golang version in go.mod |
51 | | - # https://github.com/github/codeql/issues/15647#issuecomment-2003768106 |
| 35 | + uses: github/codeql-action/init@v4 |
| 36 | + with: |
| 37 | + languages: ${{ matrix.language }} |
| 38 | + # Use security-extended query suite for maximum security coverage |
| 39 | + queries: +security-extended |
| 40 | + # Optionally add custom config file: |
| 41 | + # config-file: .github/codeql/codeql-config.yml |
| 42 | + |
| 43 | + # For Go: Build the code so CodeQL can analyze data flow |
| 44 | + - name: Build Go code |
| 45 | + if: matrix.language == 'go' |
| 46 | + run: | |
| 47 | + cd src |
| 48 | + go build -v ./... |
| 49 | +
|
| 50 | + # JavaScript/TypeScript doesn't need building |
| 51 | + # CodeQL will analyze it directly |
52 | 52 |
|
53 | 53 | - name: Perform CodeQL Analysis |
54 | | - uses: github/codeql-action/analyze@v3 |
| 54 | + uses: github/codeql-action/analyze@v4 |
| 55 | + with: |
| 56 | + category: "/language:${{ matrix.language }}" |
0 commit comments