diff --git a/.danger/pr_detekt.df.kts b/.danger/pr_detekt.df.kts new file mode 100644 index 00000000..b4f4f448 --- /dev/null +++ b/.danger/pr_detekt.df.kts @@ -0,0 +1,24 @@ +@file:DependsOn("io.github.vacxe.danger.kotlin:detekt:1.1.0") + +import systems.danger.kotlin.* +import systems.danger.kotlin.models.github.* +import io.github.vacxe.danger.kotlin.detekt.* +import java.io.File + +val detektPlugin = DetektPlugin { it.removePrefix("/home/runner/work/Kakao/Kakao/") } +register.plugin(detektPlugin) + +danger(args) { + detektReport() +} + +fun detektReport() { + val detektReportFile = File("build/reports/detekt/detekt.xml") + if (!detektReportFile.exists()) { + warn( + "Detekt report not exist", + ) + } else { + detektPlugin.parseAndReport(detektReportFile) + } +} diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 54964f4e..01ad02d3 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -11,9 +11,24 @@ jobs: with: distribution: "temurin" java-version: 17 + cache: gradle - name: detekt run: | ./gradlew clean detekt + - name: Upload Detekt Artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: detektArtifacts + path: build/reports/detekt + - name: Danger + uses: danger/kotlin@1.3.1 + if: always() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + dangerfile: ".danger/pr_detekt.df.kts" + args: "--failOnErrors --no-publish-check" assemble-debug-apk: needs: [ detekt ] @@ -26,6 +41,7 @@ jobs: with: distribution: "temurin" java-version: 17 + cache: gradle - name: Assemble Debug APK run: bash ./gradlew sample:assembleDebug - name: Upload app APK @@ -45,6 +61,7 @@ jobs: with: distribution: "temurin" java-version: 17 + cache: gradle - name: Assemble Instrumental APK run: bash ./gradlew sample:assembleDebugAndroidTest - name: Upload app APK