|
8 | 8 | detekt: |
9 | 9 | name: detekt |
10 | 10 | runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + security-events: write |
11 | 13 |
|
12 | 14 | steps: |
13 | | - - name: "checkout" |
| 15 | + - name: 🥏 Checkout |
14 | 16 | uses: actions/checkout@v4 |
15 | | - |
16 | | - - name: "detekt" |
17 | | - |
18 | | - # from: https://github.com/natiginfo/action-detekt-all |
| 17 | + - name: ☕️ JREv17 |
| 18 | + uses: actions/setup-java@v5 |
19 | 19 | with: |
20 | | - args: --config .github/detekt-config.yml |
| 20 | + # default: jdk |
| 21 | + java-package: 'jre' |
| 22 | + # github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Java-version-file |
| 23 | + java-version: '17' |
| 24 | + # github.com/actions/setup-java?tab=readme-ov-file#supported-distributions |
| 25 | + distribution: 'temurin' |
| 26 | + - name: 🤺 Detekt |
| 27 | + run: | |
| 28 | + set -euo pipefail |
| 29 | + # from: github.com/natiginfo/action-detekt-all |
| 30 | + wget -q https://github.com/detekt/detekt/releases/download/v${DETEKT_VER}/detekt-cli-${DETEKT_VER}-all.jar -O detekt-cli-all.jar |
21 | 31 |
|
| 32 | + # detekt.github.io/detekt/cli.html#use-the-cli |
| 33 | + java -jar detekt-cli-all.jar \ |
| 34 | + --build-upon-default-config \ |
| 35 | + --config .github/detekt-config.yml \ |
| 36 | + --fail-on-severity ${SEV} \ |
| 37 | + --analysis-mode full \ |
| 38 | + --api-version ${KOTLIN_VER} \ |
| 39 | + --jvm-target ${JVM_TARGET} \ |
| 40 | + --language-version ${KOTLIN_VER} \ |
| 41 | + --parallel \ |
| 42 | + --report sarif:rethink-app-detekt-${RUNID}.sarif |
| 43 | + shell: bash |
| 44 | + env: |
| 45 | + RUNID: ${{ github.run_id }} |
| 46 | + # recommended versions: github.com/detekt/detekt?tab=readme-ov-file#executing-detekt |
| 47 | + DETEKT_VER: "2.0.0-alpha.1" |
| 48 | + # github.com/celzero/rethink-app/blob/main/app/build.gradle#L199 |
| 49 | + # one of: [1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] |
| 50 | + JVM_TARGET: "17" |
| 51 | + # one of: [Error, Warning, Info, Never] |
| 52 | + SEV: "Warning" |
| 53 | + # WARNING: Keep major.minor version (e.g., "2.1") in sync with build.gradle (ext.kotlin_version, line 4)! |
| 54 | + # Only the major.minor part is required here, not the full version (e.g., "2.1.20"). |
| 55 | + # github.com/celzero/rethink-app/blob/main/build.gradle#L4 |
| 56 | + KOTLIN_VER: "2.1" |
| 57 | + - name: 📤 Upload |
| 58 | + if: always() |
| 59 | + # TODO: docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning |
| 60 | + # docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning |
| 61 | + # docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github |
| 62 | + # github.com/github/codeql-action/blob/v4/upload-sarif/action.yml |
| 63 | + uses: github/codeql-action/upload-sarif@v4 |
| 64 | + with: |
| 65 | + # Path to SARIF file relative to the root of the repository |
| 66 | + sarif_file: "rethink-app-detekt-${{ github.run_id }}.sarif" |
| 67 | + # Optional category for the results |
| 68 | + # Used to differentiate multiple results for one commit |
| 69 | + # category: rethink-app |
0 commit comments