-
-
Notifications
You must be signed in to change notification settings - Fork 368
/
dangerfile.lite.ts
26 lines (21 loc) · 1016 Bytes
/
dangerfile.lite.ts
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
import * as fs from "fs"
import { DangerDSLType } from "./source/dsl/DangerDSL"
declare var danger: DangerDSLType
declare function warn(params: string): void
const hasChangelog = danger.git.modified_files.includes("CHANGELOG.md")
const isTrivial = danger.github && (danger.github.pr.body + danger.github.pr.title).includes("#trivial")
if (!hasChangelog && !isTrivial) {
warn(
"Please add a changelog entry for your changes. You can find it in `CHANGELOG.md` \n\nPlease add your change and name to the main section."
)
}
// Always ensure we name all CI providers in the README. These
// regularly get forgotten on a PR adding a new one.
const sentence = danger.utils.sentence
import { realProviders } from "./source/ci_source/providers"
const readme = fs.readFileSync("README.md").toString()
const names = realProviders.map((p) => new p({}).name)
const missing = names.filter((n) => !readme.includes(n))
if (missing.length) {
warn(`These providers are missing from the README: ${sentence(missing)}`)
}