Update buildSrc/src/main/kotlin/com/icemachined/buildutils/kotlin-lib… #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run diKTat | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
diktat_check: | |
runs-on: ubuntu-20.04 | |
env: | |
GRADLE_OPTS: -Dorg.gradle.daemon=false | |
steps: | |
- uses: actions/checkout@v2.4.0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: zulu | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: wrapper | |
arguments: | | |
diktatCheck | |
-Pdiktat.githubActions=true | |
-Pdetekt.multiplatform.disabled=true | |
# Upload reports only if code style checks were failed | |
- name: Copy SARIF reports into a single directory | |
if: ${{ failure() }} | |
run: | | |
mkdir -p build/diktat-sarif-reports | |
i=0 | |
find . -path "*/build/reports/diktat/*.sarif" | while read -r f; do echo "$f -> diktat-$i.sarif" && cp $f build/diktat-sarif-reports/diktat-$i.sarif || echo Cannot copy && echo Copied && i=$((i+1)); done | |
- name: Upload SARIF report to Github | |
uses: github/codeql-action/upload-sarif@v1 | |
if: ${{ failure() }} | |
with: | |
sarif_file: build/diktat-sarif-reports | |
- name: Upload SARIF artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: sarif-reports | |
path: "**/build/diktat-sarif-reports/" | |
retention-days: 1 |