|
| 1 | +name: "CodeQL Scan" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + analyze: |
| 11 | + name: Analyze Java |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + # required for all workflows |
| 15 | + security-events: write |
| 16 | + |
| 17 | + # required to fetch internal or private CodeQL packsCodeQ |
| 18 | + packages: read |
| 19 | + |
| 20 | + # only required for workflows in private repositories |
| 21 | + actions: read |
| 22 | + contents: read |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - language: java-kotlin |
| 29 | + build-mode: autobuild |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Initialize CodeQL |
| 35 | + uses: github/codeql-action/init@v3 |
| 36 | + with: |
| 37 | + languages: ${{ matrix.language }} |
| 38 | + build-mode: ${{ matrix.build-mode }} |
| 39 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 40 | + # By default, queries listed here will override any specified in a config file. |
| 41 | + # Prefix the list here with "+" to use these queries and those in the config file. |
| 42 | + |
| 43 | + # 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 |
| 44 | + queries: ${{ matrix.language == 'java-kotlin' && 'security-extended, security-and-quality' }} |
| 45 | + |
| 46 | + # If the analyze step fails for one of the languages you are analyzing with |
| 47 | + # "We were unable to automatically build your code", modify the matrix above |
| 48 | + # to set the build mode to "manual" for that language. Then modify this step |
| 49 | + # to build your code. |
| 50 | + # ℹ️ Command-line programs to run using the OS shell. |
| 51 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 52 | + - if: matrix.build-mode == 'manual' |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + echo 'If you are using a "manual" build mode for one or more of the' \ |
| 56 | + 'languages you are analyzing, replace this with the commands to build' \ |
| 57 | + 'your code, for example:' |
| 58 | + echo ' make bootstrap' |
| 59 | + echo ' make release' |
| 60 | + exit 1 |
| 61 | +
|
| 62 | + - name: Perform CodeQL Analysis |
| 63 | + uses: github/codeql-action/analyze@v3 |
| 64 | + with: |
| 65 | + category: "/language:${{matrix.language}}" |
0 commit comments