Add some more rules to dangerfile (#1560)

* warn if the target branch is not master
* link to the logo guidance if PR modifies a SVG file in /logo/
This commit is contained in:
chris48s
2018-03-11 20:05:49 +00:00
committed by GitHub
parent ae848f38f4
commit f8d511fae2

View File

@@ -23,17 +23,27 @@ const helpers = fileMatch(
'!**/*.spec.js',
'!lib/all-badge-examples.js'
);
const logos = fileMatch(
'logo/*.svg'
);
const helperTests = fileMatch('lib/**/*.spec.js');
const packageJson = fileMatch('package.json');
const packageLock = fileMatch('package-lock.json');
const capitals = fileMatch('**/*[A-Z]*.js');
const underscores = fileMatch('**/*_*.js');
const targetBranch = danger.github.pr.base.ref;
message([
':sparkles: Thanks for your contribution to Shields, ',
`@${danger.github.pr.user.login}!`
].join(''));
if (targetBranch != 'master') {
const message = `This PR targets \`${targetBranch}\``;
const idea = 'It is likely that the target branch should be `master`';
warn(`${message} - <i>${idea}</i>`);
}
if (documentation.createdOrModified) {
message([
'Thanks for contributing to our documentation. ',
@@ -66,6 +76,15 @@ if (helpers.created && !helperTests.created) {
].join(''));
}
if (logos.created) {
message([
':art: Thanks for submitting a logo. ',
'Please ensure your contribution follows our ',
'[guidance](https://github.com/badges/shields/blob/master/CONTRIBUTING.md#logos) ',
'for logo submissions.'
].join(''));
}
if (capitals.created || underscores.created) {
fail([
'JavaScript source files should be named with kebab-case ',