From ab19e365c1962db5d94b2cc713ab9216024fc80d Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 19 Sep 2024 21:15:37 +0200 Subject: Add inline warning and errors to github actions --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/detekt.yml | 14 -------------- 2 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 .github/workflows/detekt.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c12349e9..d1af96882 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,26 @@ jobs: - name: Run detekt run: | ./gradlew detekt --stacktrace + - name: Annotate detekt failures + run: | + read -r -d '' jq_command <<'EOF' + .runs[].results[] | + { + "l": .locations[].physicalLocation, + "level": .level, + "message":.message, + "ruleId":.ruleId + } | + ( + "::" + (.level) + + " file=" + ( .l.artifactLocation.uri | sub("file://$(pwd)/"; "")) + + ",line=" + (.l.region.startLine|tostring) + + ",endLine=" + (.l.region.endLine|tostring) + + ",col=" + (.l.region.startColumn|tostring) + + ",endColumn=" + (.l.region.endColumn|tostring) + + ",title=" + (.ruleId) + "::" + (.message.text)) + EOF + jq -r "$jq_command" < versions/1.8.9/build/reports/detekt/detekt.sarif preprocess: diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml deleted file mode 100644 index 708f9a19e..000000000 --- a/.github/workflows/detekt.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: detekt -on: - - pull_request -jobs: - detekt: - name: Run detekt - runs-on: ubuntu-latest - - steps: - - name: "Checkout project" - uses: actions/checkout@v4 - - - name: "detekt" - uses: natiginfo/action-detekt-all@1.23.7 -- cgit