|
| 1 | +name: CodeQL |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + schedule: |
| 11 | + - cron: "07 04 * * 4" # weekly at 04:07 UTC on Thursday |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + analyze: |
| 18 | + name: Analyze (${{ matrix.language }}) |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + actions: read # for github/codeql-action/init to get workflow details |
| 22 | + security-events: write # for github/codeql-action/analyze to upload SARIF results |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - language: actions |
| 28 | + - language: java |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 32 | + |
| 33 | + - name: Set up Java 17 |
| 34 | + if: matrix.language == 'java' |
| 35 | + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 |
| 36 | + with: |
| 37 | + distribution: temurin |
| 38 | + java-version: 17 |
| 39 | + |
| 40 | + - name: Set up gradle |
| 41 | + if: matrix.language == 'java' |
| 42 | + uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0 |
| 43 | + |
| 44 | + - name: Initialize CodeQL |
| 45 | + uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19 |
| 46 | + with: |
| 47 | + languages: ${{ matrix.language }} |
| 48 | + # using "latest" helps to keep up with the latest Kotlin support |
| 49 | + # see https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433 |
| 50 | + tools: latest |
| 51 | + |
| 52 | + - name: Assemble |
| 53 | + if: matrix.language == 'java' |
| 54 | + # --no-build-cache is required for codeql to analyze all modules |
| 55 | + # --no-daemon is required for codeql to observe the compilation |
| 56 | + # (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands) |
| 57 | + run: ./gradlew assemble --no-build-cache --no-daemon |
| 58 | + |
| 59 | + - name: Perform CodeQL analysis |
| 60 | + uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19 |
| 61 | + with: |
| 62 | + category: "/language:${{matrix.language}}" |
| 63 | + |
| 64 | + workflow-notification: |
| 65 | + permissions: |
| 66 | + contents: read |
| 67 | + issues: write |
| 68 | + needs: |
| 69 | + - analyze |
| 70 | + if: always() |
| 71 | + uses: ./.github/workflows/reusable-workflow-notification.yml |
| 72 | + with: |
| 73 | + success: ${{ needs.analyze.result == 'success' }} |
0 commit comments