-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dangerfile.df.kts
30 lines (26 loc) · 917 Bytes
/
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
@file:Suppress("ktlint:standard:no-wildcard-imports")
import systems.danger.kotlin.*
import systems.danger.kotlin.models.github.GitHubIssueLabel
danger(args) {
if (git.modifiedFiles.any { it.contains("json-schema-validator/api/") }) {
markdown(
"## PR introduces changes to the public API\n" +
"Please add **\"ABI breaking\"** label if **any line** in API file was changed or deleted.<br/>" +
"Please add **\"API breaking\"** label if **any public method** in API file was changed or deleted.",
)
}
onGitHub {
val prLabels = issue.labels
checkPrLabels(prLabels)
}
}
fun checkPrLabels(prLabels: List<GitHubIssueLabel>) {
when (prLabels.size) {
0 -> fail("PR must have labels")
1 ->
prLabels.find { it.name.equals("ignore", ignoreCase = true) }?.let {
warn("PR must have labels other then '[${it.name}](${it.url})'")
}
else -> {}
}
}