forked from danreeves/react-tether
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdangerfile.js
30 lines (24 loc) · 924 Bytes
/
dangerfile.js
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
import { warn, message, schedule, danger } from 'danger';
import { istanbulCoverage } from 'danger-plugin-istanbul-coverage';
const modified = danger.git.modified_files;
const modifiedSrc = modified.filter(p => p.includes('src/'));
const changelogChanges = modified.find(f => f === 'CHANGELOG.md');
const testChanges = modified.filter(p => p.includes('tests/'));
message(
`Hey @${
danger.github.pr.user.login
}, thanks for submitting a pull request! :smile_cat:`
);
// Updates to the source require changelog updates
if (modifiedSrc.length > 1 && !changelogChanges) {
warn(`You changed a source file but didn't add to the changelog`);
}
// Pull requests should have descriptions
if (danger.github.pr.body.length === 0) {
warn('Please add a description to your PR');
}
// You added tests :tada:
if (testChanges.length > 0) {
message(':tada: Thanks for working on tests!');
}
schedule(istanbulCoverage());