sforkowany z mirror/soapbox
Dangerfile: warn when MR needs tests, thank when updating docs
rodzic
30bac2b005
commit
2adf04d164
|
@ -1,15 +1,13 @@
|
||||||
import { danger, warn } from 'danger';
|
import { danger, warn, message } from 'danger';
|
||||||
|
|
||||||
// No PR is too small to include a description of why you made a change
|
const docs = danger.git.fileMatch('docs/**/*.md');
|
||||||
if (danger.gitlab.mr.description.length < 10) {
|
const app = danger.git.fileMatch('app/**/*.(js|ts|tsx)');
|
||||||
warn('Please include a description of your PR changes.');
|
const tests = danger.git.fileMatch('*/__tests__/*');
|
||||||
|
|
||||||
|
if (docs.edited) {
|
||||||
|
message('Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a CHANGELOG entry
|
if (app.modified && !tests.modified) {
|
||||||
const hasChangelog = danger.git.modified_files.some(f => f === 'CHANGELOG.md');
|
warn('You have app changes without tests.');
|
||||||
const description = danger.gitlab.mr.description + danger.gitlab.mr.title;
|
|
||||||
const isTrivial = description.includes('#trivial');
|
|
||||||
|
|
||||||
if (!hasChangelog && !isTrivial) {
|
|
||||||
warn('Please add a changelog entry for your changes.');
|
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue