generated from AdamMc331/AndroidAppTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dangerfile.df.kts
43 lines (32 loc) · 1.29 KB
/
Dangerfile.df.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@file:Suppress("MagicNumber", "WildcardImport", "ForbiddenComment")
// Editing this file: https://github.com/danger/kotlin?tab=readme-ov-file#autocomplete-and-syntax-highlighting-in-intellij-idea-or-android-studio
import systems.danger.kotlin.*
import java.io.File
danger(args) {
onGitHub {
val additions = pullRequest.additions ?: 0
val deletions = pullRequest.deletions ?: 0
message("Thanks @${pullRequest.user.login}!")
if (pullRequest.body.isNullOrBlank()) {
fail("Please provide a summary in the Pull Request description.")
}
if (additions > 500) {
warn("Please consider breaking up this pull request.")
}
if (issue.labels.isEmpty()) {
warn("Please add labels to this PR.")
}
if (deletions > additions) {
message("🎉 Code Cleanup!")
}
val updatesFile = File("build/dependencyUpdates/report.txt")
val lines = updatesFile.readLines()
val headerIndex = lines.indexOfFirst { line ->
line.contains("The following dependencies have later milestone versions:")
}
if (headerIndex >= 0) {
val message = lines.subList(headerIndex, lines.size).joinToString("\n")
message(message)
}
}
}