Skip to content

Commit fc542f2

Browse files
ignoramousCopilot
andauthored
gh-actions: detailed detekt cli config (#2392)
Co-authored-by: Copilot <[email protected]>
1 parent 35e0fa4 commit fc542f2

File tree

1 file changed

+54
-6
lines changed

1 file changed

+54
-6
lines changed

.github/workflows/sa.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,62 @@ jobs:
88
detekt:
99
name: detekt
1010
runs-on: ubuntu-latest
11+
permissions:
12+
security-events: write
1113

1214
steps:
13-
- name: "checkout"
15+
- name: 🥏 Checkout
1416
uses: actions/checkout@v4
15-
16-
- name: "detekt"
17-
uses: natiginfo/[email protected]
18-
# from: https://github.com/natiginfo/action-detekt-all
17+
- name: ☕️ JREv17
18+
uses: actions/setup-java@v5
1919
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
2131
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

Comments
 (0)