-
Notifications
You must be signed in to change notification settings - Fork 42
59 lines (49 loc) · 3.25 KB
/
spotbugs-scan.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
name: "SpotBugs"
on:
push:
branches: [ adamve/spotbugs-reports-v3 ]
pull_request:
branches: [ adamve/spotbugs-reports-v3 ]
schedule:
- cron: '25 16 * * 0'
jobs:
analyze:
name: SpotBugs Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build with Gradle
run: ./gradlew spotbugsRelease spotbugsMain
- name: Fix SARIF
run: |
cat <<< $(jq '.runs |= map( if .taxonomies == [null] then .taxonomies = [] else . end)' ./build/spotbugs/spotbugs-support.sarif) > ./build/spotbugs/spotbugs-support.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "android/src/main/java/" + .' ./build/spotbugs/spotbugs-android.sarif) > ./build/spotbugs/spotbugs-android.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "AndroidDemo/src/main/java/" + .' ./build/spotbugs/spotbugs-AndroidDemo.sarif) > ./build/spotbugs/spotbugs-AndroidDemo.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "core/src/main/java/" + .' ./build/spotbugs/spotbugs-core.sarif) > ./build/spotbugs/spotbugs-core.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "fido/src/main/java/" + .' ./build/spotbugs/spotbugs-fido.sarif) > ./build/spotbugs/spotbugs-fido.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "management/src/main/java/" + .' ./build/spotbugs/spotbugs-management.sarif) > ./build/spotbugs/spotbugs-management.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "oath/src/main/java/" + .' ./build/spotbugs/spotbugs-oath.sarif) > ./build/spotbugs/spotbugs-oath.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "openpgp/src/main/java/" + .' ./build/spotbugs/spotbugs-openpgp.sarif) > ./build/spotbugs/spotbugs-openpgp.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "piv/src/main/java/" + .' ./build/spotbugs/spotbugs-piv.sarif) > ./build/spotbugs/spotbugs-piv.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "support/src/main/java/" + .' ./build/spotbugs/spotbugs-support.sarif) > ./build/spotbugs/spotbugs-support.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "testing/src/main/java/" + .' ./build/spotbugs/spotbugs-testing.sarif) > ./build/spotbugs/spotbugs-testing.sarif
cat <<< $(jq '.runs[].results[].locations[].physicalLocation.artifactLocation.uri |= "yubiotp/src/main/java/" + .' ./build/spotbugs/spotbugs-yubiotp.sarif) > ./build/spotbugs/spotbugs-yubiotp.sarif
- name: upload SARIF
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: build/spotbugs/
category: spotbugs-analysis