name: Run diKTat

on:
  push:
    branches: [ main ]
  pull_request:

jobs:
  diktat_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin
      - uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            diktatCheck
            mergeDiktatReports
            -Pdetekt.multiplatform.disabled=true
            -Pdiktat.githubActions=true
            --continue
      - name: Upload SARIF report to Github
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: build/reports/diktat/diktat-merged.sarif
