-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdangerfile.ts
35 lines (30 loc) · 1.33 KB
/
dangerfile.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
27
28
29
30
31
32
33
34
35
import { warn, fail, danger, schedule } from "danger";
import coverage from "danger-plugin-coverage";
// import { warnDependencies } from "danger-plugin-node-dependencies";
import * as completePr from "danger-plugin-complete-pr";
schedule(coverage());
// warnDependencies();
// const modifiedMD = danger.git.modified_files.join("- ");
// message("Changed Files in this PR: \n - " + modifiedMD);
const bigPRThreshold = 600;
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
warn(
"Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review."
);
}
const packageChanged = danger.git.modified_files.includes("package.json");
const lockfileChanged = danger.git.modified_files.includes("pnpm-lock.yaml");
if (packageChanged && !lockfileChanged) {
const message = "Changes were made to package.json, but not to pnpm-lock.yaml";
const idea = "Perhaps you need to run `pnpm install`?";
warn(`${message} - <i>${idea}</i>`);
}
// const pr = danger.github.pr;
// if (pr.assignee === null) {
// fail(
// "Please assign someone to merge this PR, and optionally include people who should review."
// );
// }
completePr.checkAssignees();
completePr.checkDescription(10);
completePr.checkTitle(/^[[A-Za-z]+-\d+]/);