Skip to content

Commit b750e3b

Browse files
hramosfacebook-github-bot
authored andcommitted
Update to Danger 2.0
Summary: See #17234 for discussion. Closes #17310 Differential Revision: D6627914 Pulled By: hramos fbshipit-source-id: 3d72fc69fe03c53706d2076ecf7b5321a00d1642
1 parent 077c3ab commit b750e3b

File tree

2 files changed

+2
-48
lines changed

2 files changed

+2
-48
lines changed

danger/dangerfile.js

+1-47
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,6 @@ const minimatch = require('minimatch');
1515

1616
import { danger, fail, markdown, message, warn } from 'danger';
1717

18-
const isDocsFile = path => includes(path, 'docs/');
19-
const editsDocs = danger.git.modified_files.filter(isDocsFile).length > 0;
20-
const addsDocs = danger.git.created_files.filter(isDocsFile).length > 0;
21-
if (addsDocs || editsDocs) {
22-
// Note, this does not yet cover edits to the autogenerated docs
23-
// (e.g. comments within JS source files)
24-
const title = ':page_facing_up: Docs';
25-
const idea = 'Thanks for your contribution to the docs!';
26-
message(`${title} - <i>${idea}</i>`);
27-
28-
// Add the Documentation label via bot, as @facebook-open-source-bot does not have write privileges on the repo.
29-
markdown('@facebook-github-bot label Documentation');
30-
}
31-
32-
const isBlogFile = path => includes(path, 'blog/');
33-
34-
// Flags new blog posts. Note that mentions will not be parsed as the access token we're using does
35-
// not belong to the Facebook org (on purpose)
36-
const addsBlogPost = danger.git.created_files.filter(isBlogFile).length > 0;
37-
if (addsBlogPost) {
38-
const title = ':memo: Blog post';
39-
const idea = 'This PR appears to add a new blog post, ' +
40-
'and may require further review from the React Native team.';
41-
warn(`${title} - <i>${idea}</i>`);
42-
}
43-
44-
// Flags edits to blog posts
45-
const editsBlogPost = danger.git.modified_files.filter(isBlogFile).length > 0;
46-
if (editsBlogPost) {
47-
const title = ':memo: Blog post';
48-
const idea = 'This PR appears to edit an existing blog post, ' +
49-
'and may require further review from the React Native team.';
50-
warn(`${title} - <i>${idea}</i>`);
51-
}
52-
5318
// Fails if the description is too short.
5419
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
5520
fail(':grey_question: This pull request needs a description.');
@@ -74,19 +39,8 @@ if (packageChanged) {
7439
}
7540

7641
// Warns if a test plan is missing.
77-
const gettingStartedChanged = includes(danger.git.modified_files, 'docs/GettingStarted.md');
7842
const includesTestPlan = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('test plan');
79-
80-
// Warns if a test plan is missing, when editing the Getting Started guide. This page needs to be
81-
// tested in all its permutations.
82-
if (!includesTestPlan && gettingStartedChanged) {
83-
const title = ':clipboard: Test Plan';
84-
const idea = 'This PR appears to be missing a Test Plan.';
85-
warn(`${title} - <i>${idea}</i>`);
86-
markdown('@facebook-github-bot label Needs more information');
87-
}
88-
// Doc edits rarely require a test plan. We'll trust the reviewer to push back if one is needed.
89-
if (!includesTestPlan && !editsDocs) {
43+
if (!includesTestPlan) {
9044
const title = ':clipboard: Test Plan';
9145
const idea = 'This PR appears to be missing a Test Plan.';
9246
warn(`${title} - <i>${idea}</i>`);

danger/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"danger": "node ./node_modules/.bin/danger"
55
},
66
"devDependencies": {
7-
"danger": "^1.2.0",
7+
"danger": "^2.1.6",
88
"lodash.includes": "^4.3.0",
99
"minimatch": "^3.0.4"
1010
}

0 commit comments

Comments
 (0)