| 1 | # For most projects, this workflow file will not need changing; you simply need |
| 2 | # to commit it to your repository. |
| 3 | # |
| 4 | # You may wish to alter this file to override the set of languages analyzed, |
| 5 | # or to provide custom queries or build logic. |
| 6 | name: "CodeQL" |
| 7 | |
| 8 | on: |
| 9 | push: |
| 10 | branches: [master] |
| 11 | paths-ignore: ['**.md'] |
| 12 | pull_request: |
| 13 | # The branches below must be a subset of the branches above |
| 14 | branches: [master] |
| 15 | paths-ignore: ['**.md'] |
| 16 | schedule: |
| 17 | - cron: '0 20 * * 4' |
| 18 | |
| 19 | concurrency: |
| 20 | group: CodeQL-${{ github.ref }} |
| 21 | cancel-in-progress: true |
| 22 | |
| 23 | permissions: |
| 24 | contents: read |
| 25 | |
| 26 | jobs: |
| 27 | analyze: |
| 28 | permissions: |
| 29 | actions: read # for github/codeql-action/init to get workflow details |
| 30 | contents: read # for actions/checkout to fetch code |
| 31 | security-events: write # for github/codeql-action/autobuild to send a status report |
| 32 | name: Analyze |
| 33 | runs-on: ubuntu-latest |
| 34 | |
| 35 | strategy: |
| 36 | fail-fast: false |
| 37 | matrix: |
| 38 | # Override automatic language detection by changing the below list |
| 39 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] |
| 40 | language: ['cpp'] |
| 41 | # Learn more... |
| 42 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection |
| 43 | |
| 44 | steps: |
| 45 | - name: Checkout repository |
| 46 | uses: actions/checkout@v4 |
| 47 | with: |
| 48 | # We must fetch at least the immediate parents so that if this is |
| 49 | # a pull request then we can checkout the head. |
| 50 | fetch-depth: 2 |
| 51 | |
| 52 | # If this run was triggered by a pull request event, then checkout |
| 53 | # the head of the pull request instead of the merge commit. |
| 54 | - run: git checkout HEAD^2 |
| 55 | if: ${{ github.event_name == 'pull_request' }} |
| 56 | |
| 57 | # Initializes the CodeQL tools for scanning. |
| 58 | - name: Initialize CodeQL |
| 59 | uses: github/codeql-action/init@v3 |
| 60 | with: |
| 61 | languages: ${{ matrix.language }} |
| 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. |
| 65 | # queries: ./path/to/local/query, your-org/your-repo/queries@main |
| 66 | |
| 67 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
| 68 | # If this step fails, then you should remove it and run the build manually (see below) |
| 69 | - name: Autobuild |
| 70 | uses: github/codeql-action/autobuild@v3 |
| 71 | |
| 72 | # ℹ️ Command-line programs to run using the OS shell. |
| 73 | # 📚 https://git.io/JvXDl |
| 74 | |
| 75 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines |
| 76 | # and modify them (or add more) to build your code if your project |
| 77 | # uses a compiled language |
| 78 | |
| 79 | #- run: | |
| 80 | # make bootstrap |
| 81 | # make release |
| 82 | |
| 83 | - name: Perform CodeQL Analysis |
| 84 | uses: github/codeql-action/analyze@v3 |