|
1 | 1 | # CodeQL Analysis |
2 | | -name: "CodeQL" |
| 2 | +name: "CodeQL Advanced" |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | push: |
6 | | - branches: [main] |
| 6 | + branches: [ "main" ] |
7 | 7 | pull_request: |
8 | | - # The branches below must be a subset of the branches above |
9 | | - branches: [main] |
10 | | - schedule: |
11 | | - - cron: '30 1 * * 0' |
| 8 | + branches: [ "main" ] |
12 | 9 |
|
13 | 10 | jobs: |
14 | 11 | analyze: |
15 | | - name: Analyze |
16 | | - runs-on: ubuntu-latest |
| 12 | + name: Analyze (${{ matrix.language }}) |
| 13 | + # Runner size impacts CodeQL analysis time. To learn more, please see: |
| 14 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 15 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 16 | + # - https://gh.io/using-larger-runners (GitHub.com only) |
| 17 | + # Consider using larger runners or machines with greater resources for possible analysis time improvements. |
| 18 | + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} |
| 19 | + permissions: |
| 20 | + # required for all workflows |
| 21 | + security-events: write |
| 22 | + |
| 23 | + # required to fetch internal or private CodeQL packs |
| 24 | + packages: read |
| 25 | + |
| 26 | + # only required for workflows in private repositories |
| 27 | + actions: read |
| 28 | + contents: read |
17 | 29 |
|
18 | 30 | strategy: |
19 | 31 | fail-fast: false |
20 | 32 | matrix: |
21 | | - # Override automatic language detection by changing the below list |
22 | | - # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection |
23 | | - language: ['javascript'] |
24 | | - |
| 33 | + include: |
| 34 | + - language: actions |
| 35 | + build-mode: none |
| 36 | + - language: javascript-typescript |
| 37 | + build-mode: none |
| 38 | + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' |
| 39 | + # Use `c-cpp` to analyze code written in C, C++ or both |
| 40 | + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both |
| 41 | + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both |
| 42 | + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, |
| 43 | + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. |
| 44 | + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how |
| 45 | + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages |
25 | 46 | steps: |
26 | 47 | - name: Checkout repository |
27 | | - uses: actions/checkout@v2 |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + # Add any setup steps before running the `github/codeql-action/init` action. |
| 51 | + # This includes steps like installing compilers or runtimes (`actions/setup-node` |
| 52 | + # or others). This is typically only required for manual builds. |
| 53 | + # - name: Setup runtime (example) |
| 54 | + # uses: actions/setup-example@v1 |
28 | 55 |
|
29 | 56 | # Initializes the CodeQL tools for scanning. |
30 | 57 | - name: Initialize CodeQL |
31 | | - uses: github/codeql-action/init@v1 |
| 58 | + uses: github/codeql-action/init@v3 |
32 | 59 | with: |
33 | 60 | languages: ${{ matrix.language }} |
| 61 | + build-mode: ${{ matrix.build-mode }} |
| 62 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 63 | + # By default, queries listed here will override any specified in a config file. |
| 64 | + # Prefix the list here with "+" to use these queries and those in the config file. |
34 | 65 |
|
35 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
36 | | - # If this step fails, then you should remove it and run the build manually (see below) |
37 | | - - name: Autobuild |
38 | | - uses: github/codeql-action/autobuild@v1 |
| 66 | + # 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 |
| 67 | + # queries: security-extended,security-and-quality |
39 | 68 |
|
| 69 | + # If the analyze step fails for one of the languages you are analyzing with |
| 70 | + # "We were unable to automatically build your code", modify the matrix above |
| 71 | + # to set the build mode to "manual" for that language. Then modify this step |
| 72 | + # to build your code. |
40 | 73 | # ℹ️ Command-line programs to run using the OS shell. |
41 | | - # 📚 https://git.io/JvXDl |
| 74 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 75 | + - if: matrix.build-mode == 'manual' |
| 76 | + shell: bash |
| 77 | + run: | |
| 78 | + echo 'If you are using a "manual" build mode for one or more of the' \ |
| 79 | + 'languages you are analyzing, replace this with the commands to build' \ |
| 80 | + 'your code, for example:' |
| 81 | + echo ' make bootstrap' |
| 82 | + echo ' make release' |
| 83 | + exit 1 |
| 84 | +
|
42 | 85 | - name: Perform CodeQL Analysis |
43 | | - uses: github/codeql-action/analyze@v1 |
| 86 | + uses: github/codeql-action/analyze@v3 |
| 87 | + with: |
| 88 | + category: "/language:${{matrix.language}}" |
0 commit comments