-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dangerfile.df.kts
32 lines (27 loc) · 1.11 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
/*
* Copyright (C) 2024 Nicholas Doglio
* SPDX-License-Identifier: MIT
*/
import systems.danger.kotlin.danger
import systems.danger.kotlin.onGitHub
import systems.danger.kotlin.warn
danger(args) {
val allSourceFiles = git.modifiedFiles + git.createdFiles
val sourceChanges = allSourceFiles.filter { path -> path.contains("src") }
onGitHub {
// Ensure all major changes are mentioned in changelog
if (!allSourceFiles.contains("CHANGELOG.md") && sourceChanges.isNotEmpty()) {
warn(
"Any major changes should be added to our [`CHANGELOG.md`](CHANGELOG.md) file\n" +
"Changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)."
)
}
// Ensure all PRs are small and easy to review
if ((pullRequest.additions ?: 0) - (pullRequest.deletions ?: 0) > 300) {
warn(
"This is a large pull request, can we break it down into multiple smaller PRs? " +
"Considering [stacking](https://www.stacking.dev/) them if that helps"
)
}
}
}