From 5fe94dc1453fe004b9a6c8d7aab992cf891c5c2d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Mon, 31 Jul 2017 16:14:54 -0400 Subject: [PATCH] Configure Renovate (#897) * Add renovate.json * update renovate * fix dangerfile --- .github/settings.yml | 2 +- dangerfile.ts | 79 ++++++++++++++++++++++++-------------------- renovate.json | 12 +++++++ 3 files changed, 57 insertions(+), 36 deletions(-) create mode 100644 renovate.json diff --git a/.github/settings.yml b/.github/settings.yml index 8d31da201d..35fc3ebde4 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -29,7 +29,7 @@ labels: color: c2e0c6 - name: feature color: 5319e7 - - name: greenkeeper + - name: dependencies color: ededed - name: idea color: fbca04 diff --git a/dangerfile.ts b/dangerfile.ts index 2468444fff..2140ebe988 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -4,6 +4,7 @@ import * as fs from 'fs'; // Setup const pr = danger.github.pr; +const commits = danger.github.commits; const modified = danger.git.modified_files; const bodyAndTitle = (pr.body + pr.title).toLowerCase(); @@ -57,44 +58,52 @@ const raiseIssueAboutPaths = ( } }; -// Rules -// When there are app-changes and it's not a PR marked as trivial, expect -// there to be CHANGELOG changes. -const changelogChanges = includes(modified, 'Changelog.md'); -if (modifiedAppFiles.length > 0 && !trivialPR && !changelogChanges) { - fail('No CHANGELOG added.'); -} +const authors = commits.map(x => x.author.login); +const isBot = authors.some(x => ['greenkeeper', 'renovate'].indexOf(x) > -1); -// No PR is too small to warrant a paragraph or two of summary -if (pr.body.length === 0) { - fail('Please add a description to your PR.'); -} +if (!isBot) { + // Rules + // When there are app-changes and it's not a PR marked as trivial, expect + // there to be CHANGELOG changes. + const changelogChanges = includes(modified, 'Changelog.md'); + if (modifiedAppFiles.length > 0 && !trivialPR && !changelogChanges) { + fail('No CHANGELOG added.'); + } -const hasAppChanges = modifiedAppFiles.length > 0; + // No PR is too small to warrant a paragraph or two of summary + if (pr.body.length === 0) { + fail('Please add a description to your PR.'); + } -const hasTestChanges = modifiedTestFiles.length > 0; + const hasAppChanges = modifiedAppFiles.length > 0; -// Warn when there is a big PR -const bigPRThreshold = 500; -if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) { - warn(':exclamation: Big PR'); -} + const hasTestChanges = modifiedTestFiles.length > 0; -// Warn if there are library changes, but not tests -if (hasAppChanges && !hasTestChanges) { - warn( - "There are library changes, but not tests. That's OK as long as you're refactoring existing code", - ); -} + // Warn when there is a big PR + const bigPRThreshold = 500; + if ( + danger.github.pr.additions + danger.github.pr.deletions > + bigPRThreshold + ) { + warn(':exclamation: Big PR'); + } + + // Warn if there are library changes, but not tests + if (hasAppChanges && !hasTestChanges) { + warn( + "There are library changes, but not tests. That's OK as long as you're refactoring existing code", + ); + } -// Be careful of leaving testing shortcuts in the codebase -const onlyTestFiles = modifiedTestFiles.filter(x => { - const content = fs.readFileSync(x).toString(); - return ( - content.includes('it.only') || - content.includes('describe.only') || - content.includes('fdescribe') || - content.includes('fit(') - ); -}); -raiseIssueAboutPaths(fail, onlyTestFiles, 'an `only` was left in the test'); + // Be careful of leaving testing shortcuts in the codebase + const onlyTestFiles = modifiedTestFiles.filter(x => { + const content = fs.readFileSync(x).toString(); + return ( + content.includes('it.only') || + content.includes('describe.only') || + content.includes('fdescribe') || + content.includes('fit(') + ); + }); + raiseIssueAboutPaths(fail, onlyTestFiles, 'an `only` was left in the test'); +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000000..a34005d3cb --- /dev/null +++ b/renovate.json @@ -0,0 +1,12 @@ +{ + "pinVersions": true, + "semanticCommits": true, + "depTypes": [{ "depType": "dependencies", "pinVersions": false }], + "schedule": ["after 10pm and before 5am on every weekday"], + "rebaseStalePrs": true, + "prCreation": "not-pending", + "automerge": "minor", + "labels": ["tooling", "dependencies"], + "assignees": ["@jbaxleyiii"], + "reviewers": ["@jbaxleyiii"] +}