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
import { danger, fail, markdown, schedule, warn } from "danger"
import * as path from "path"
// Get some commonly used elements out of the DSL
const pr = danger.github.pr
const modified = danger.git.modified_files
const bodyAndTitle = (pr.body + pr.title).toLowerCase()
// Custom modifiers for people submitting PRs to be able to say "skip this"
const trivialPR = bodyAndTitle.includes("trivial")
const acceptedNoTests = bodyAndTitle.includes("skip new tests")
const typescriptOnly = (file: string) => file.includes(".ts")
const filesOnly = (file: string) => file.endsWith("/")
// Custom subsets of known files
const modifiedAppFiles = modified.filter(p => p.includes("lib/")).filter(p => filesOnly(p) && typescriptOnly(p))
// Modified or Created can be treated the same a lot of the time
const touchedFiles = modified.concat(danger.git.created_files).filter(p => filesOnly(p))
const touchedAppOnlyFiles = touchedFiles.filter(
p => p.includes("src/lib/") && !p.includes("__tests__") && typescriptOnly(p)
)
// Rules
// When there are app-changes and it us not a PR marked as trivial, expect
// there to be CHANGELOG changes.
No Results