name: Detekt

on:
  pull_request:
    branches:
      - 'master'
  push:
    branches:
      - 'master'

jobs:
  detekt:
    name: Run Detekt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: 17
          distribution: 'temurin'
      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v4
      - name: Run detekt
        run: ./gradlew detekt
      - name: Upload detekt reports
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: detekt-reports
          path: |
            app/build/reports/detekt/

