From f8d511fae2057093cc0ea8cf7ea7d08f1edab82f Mon Sep 17 00:00:00 2001 From: chris48s Date: Sun, 11 Mar 2018 20:05:49 +0000 Subject: [PATCH] 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/ --- dangerfile.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dangerfile.js b/dangerfile.js index e4460ccb285cc..cf7e61bcee6dd 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -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} - ${idea}`); +} + 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 ',