File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change 1
1
@file:Suppress(" ktlint:standard:no-wildcard-imports" )
2
2
3
3
import systems.danger.kotlin.*
4
+ import systems.danger.kotlin.models.github.GitHubIssueLabel
4
5
5
6
danger(args) {
7
+ if (git.modifiedFiles.any { it.contains(" json-schema-validator/api/" ) }) {
8
+ markdown(
9
+ " ## PR introduces changes to the public API\n " +
10
+ " Please add **\" ABI breaking\" ** label if **any line** in API file was changed or deleted.<br/>" +
11
+ " Please add **\" API breaking\" ** label if **any public method** in API file was changed or deleted." ,
12
+ )
13
+ }
6
14
onGitHub {
7
15
val prLabels = issue.labels
8
- when (prLabels.size) {
9
- 0 -> fail(" PR must have labels" )
10
- 1 ->
11
- prLabels.find { it.name.equals(" ignore" , ignoreCase = true ) }?.let {
12
- warn(" PR must have labels other then '[${it.name} ](${it.url} )'" )
13
- }
14
- else -> {}
15
- }
16
+ checkPrLabels(prLabels)
17
+ }
18
+ }
19
+
20
+ fun checkPrLabels (prLabels : List <GitHubIssueLabel >) {
21
+ when (prLabels.size) {
22
+ 0 -> fail(" PR must have labels" )
23
+ 1 ->
24
+ prLabels.find { it.name.equals(" ignore" , ignoreCase = true ) }?.let {
25
+ warn(" PR must have labels other then '[${it.name} ](${it.url} )'" )
26
+ }
27
+
28
+ else -> {}
16
29
}
17
30
}
You can’t perform that action at this time.
0 commit comments