-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (68 loc) · 2.1 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Lint
on:
push:
branches: [master]
paths:
- "**/*.kt"
- "**.kts"
pull_request:
paths:
- "**/*.kt"
- "**.kts"
concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref_name}}
permissions:
contents: read
security-events: write
jobs:
ktlint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install ktlint
run: |-
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.3.1/ktlint
chmod a+x ktlint && mv ktlint $RUNNER_TOOL_CACHE/ktlint
- name: Run ktlint
id: ktlint
run: $RUNNER_TOOL_CACHE/ktlint --reporter=sarif,output=build/reports/ktlint.sarif
- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: "!cancelled() && steps.ktlint.outcome == 'failure'"
with:
sarif_file: build/reports/ktlint.sarif
# FIXME: github/codeql-action#2215
checkout_path: ${{env.HOME}}
category: ktlint
detekt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install detekt
run: |-
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
mv detekt-cli-1.23.7-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
- name: Run detekt
id: detekt
run: >-
java -jar $RUNNER_TOOL_CACHE/detekt-cli.jar --build-upon-default-config \
--jvm-target 17 -c .github/detekt.yml -r sarif:build/reports/detekt.sarif
- name: Upload report
uses: github/codeql-action/upload-sarif@v3
if: "!cancelled() && steps.detekt.outcome == 'failure'"
with:
sarif_file: build/reports/detekt.sarif
category: detekt