-
Notifications
You must be signed in to change notification settings - Fork 1
/
dangerfile.ts
23 lines (19 loc) · 910 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
const {danger, warn} = require('danger')
const {includes} = require('lodash')
// No PR is too small to include a description of why you made a change
if (danger.github.pr.body.length < 10) {
warn('Please include a description of your PR changes.');
}
// Make sure that the yarn.lock and package.json don't get out of sync
const packageChanged = includes(danger.git.modified_files, 'package.json');
const lockfileChanged = includes(danger.git.modified_files, 'yarn.lock');
if (packageChanged && !lockfileChanged) {
const message = 'Changes were made to package.json, but not to yarn.lock';
const idea = 'Perhaps you need to run `yarn install`?';
warn(`${message} - <i>${idea}</i>`);
}
// Add a CHANGELOG entry for app changes
const hasChangelog = includes(danger.git.modified_files, "changelog.md")
if (!hasChangelog) {
warn("Please add a changelog entry for your changes.")
}