forked from qwikifiers/qwik-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.dangerfile.ts
24 lines (21 loc) · 882 Bytes
/
.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
import { danger, fail, warn } from 'danger';
const warnBigPR = () => {
const filesPRThreshold = 30;
const changesPRThreshold = 300;
const files = danger.github.pr.changed_files;
const changes = danger.github.pr.additions + danger.github.pr.deletions;
if (changes > changesPRThreshold || files > filesPRThreshold) {
warn(
`:exclamation: Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR for faster, easier review.`,
);
}
};
const blockMismatches = () => {
const hasPackageChanges = danger.git.modified_files.includes('package.json');
const hasLockfileChanges = danger.git.modified_files.includes('pnpm-lock.yaml');
if (hasPackageChanges && !hasLockfileChanges) {
fail('There are package.json changes with no corresponding lockfile changes');
}
};
warnBigPR();
blockMismatches();