|
1 | 1 | name: "CodeQL" |
2 | | -on: [push, pull_request] |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
3 | 8 |
|
4 | 9 | jobs: |
5 | 10 | analyze: |
6 | 11 | name: Analyze |
7 | 12 | runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + actions: read |
| 15 | + contents: read |
| 16 | + security-events: write |
8 | 17 |
|
9 | 18 | strategy: |
10 | 19 | fail-fast: false |
11 | 20 | matrix: |
12 | 21 | language: [ 'cpp' ] |
13 | | - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] |
14 | | - # Learn more: |
15 | | - # 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 |
16 | | - |
17 | 22 | steps: |
18 | 23 | - name: Checkout repository |
19 | | - uses: actions/checkout@main |
20 | | - |
21 | | - # Initializes the CodeQL tools for scanning. |
| 24 | + uses: actions/checkout@v3 |
22 | 25 | - name: Initialize CodeQL |
23 | | - uses: github/codeql-action/init@main |
| 26 | + uses: github/codeql-action/init@v2 |
24 | 27 | with: |
25 | 28 | languages: ${{ matrix.language }} |
26 | 29 | # If you wish to specify custom queries, you can do so here or in a config file. |
27 | 30 | # By default, queries listed here will override any specified in a config file. |
28 | 31 | # Prefix the list here with "+" to use these queries and those in the config file. |
29 | | - # queries: ./path/to/local/query, your-org/your-repo/queries@main |
30 | 32 |
|
31 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
| 33 | + # 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 |
| 34 | + # queries: security-extended,security-and-quality |
| 35 | + |
| 36 | + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). |
32 | 37 | # If this step fails, then you should remove it and run the build manually (see below) |
33 | 38 | - name: Autobuild |
34 | | - uses: github/codeql-action/autobuild@main |
| 39 | + uses: github/codeql-action/autobuild@v2 |
35 | 40 |
|
36 | 41 | # ℹ️ Command-line programs to run using the OS shell. |
37 | | - # 📚 https://git.io/JvXDl |
| 42 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
38 | 43 |
|
39 | | - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines |
40 | | - # and modify them (or add more) to build your code if your project |
41 | | - # uses a compiled language |
| 44 | + # If the Autobuild fails above, remove it and uncomment the following three lines. |
| 45 | + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. |
42 | 46 |
|
43 | | - #- run: | |
44 | | - # make bootstrap |
45 | | - # make release |
| 47 | + # - run: | |
| 48 | + # echo "Run, Build Application using script" |
| 49 | + # ./location_of_script_within_repo/buildscript.sh |
| 50 | + # |
| 51 | + # In our case, this would be a CMake build step. |
46 | 52 |
|
47 | 53 | - name: Perform CodeQL Analysis |
48 | | - uses: github/codeql-action/analyze@main |
| 54 | + uses: github/codeql-action/analyze@v2 |
| 55 | + with: |
| 56 | + category: "/language:${{matrix.language}}" |
0 commit comments