Commit 6e633df 1 parent fd05a42 commit 6e633df Copy full SHA for 6e633df
File tree 4 files changed +69
-3
lines changed
4 files changed +69
-3
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,16 @@ class PRSummary {
34
34
cli . table ( 'Title' , `${ title } (#${ prid } )` ) ;
35
35
const authorHint =
36
36
this . data . authorIsNew ( ) ? ', first-time contributor' : '' ;
37
- cli . table ( 'Author' ,
38
- `${ author . name } <${ author . email } > (@${ author . login } ${ authorHint } )` ) ;
37
+
38
+ if ( author . name && author . email ) {
39
+ cli . table ( 'Author' ,
40
+ `${ author . name } <${ author . email } > (@${ author . login } ${ authorHint } )` ) ;
41
+ } else {
42
+ // Unable to retrive email/name of the PR Author
43
+ cli . warn ( 'Could not retrieve the email or name ' +
44
+ "of the PR author's from user's GitHub profile!" ) ;
45
+ }
46
+
39
47
cli . table ( 'Branch' , `${ branch } ` ) ;
40
48
cli . table ( 'Labels' , `${ labelStr } ` ) ;
41
49
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ const firstTimerPrivatePR = readJSON('first_timer_pr_with_private_email.json');
59
59
const semverMajorPR = readJSON ( 'semver_major_pr.json' ) ;
60
60
const fixAndRefPR = readJSON ( 'pr_with_fixes_and_refs.json' ) ;
61
61
const conflictingPR = readJSON ( 'conflicting_pr.json' ) ;
62
+ const emptyProfilePR = readJSON ( 'empty_profile_pr.json' ) ;
62
63
const closedPR = readJSON ( './closed_pr.json' ) ;
63
64
const mergedPR = readJSON ( './merged_pr.json' ) ;
64
65
const readme = readFile ( './README/README.md' ) ;
@@ -90,6 +91,7 @@ module.exports = {
90
91
semverMajorPR,
91
92
fixAndRefPR,
92
93
conflictingPR,
94
+ emptyProfilePR,
93
95
readme,
94
96
readmeNoTsc,
95
97
readmeNoTscE,
Original file line number Diff line number Diff line change
1
+ {
2
+ "createdAt" : " 2017-10-24T11:13:43Z" ,
3
+ "authorAssociation" : " COLLABORATOR" ,
4
+ "author" : {
5
+ "login" : " pr_author" ,
6
+ "email" : " " ,
7
+ "name" : null
8
+ },
9
+ "url" : " https://github.com/nodejs/node/pull/18721" ,
10
+ "bodyHTML" : " <p>Fix mdn links</p>" ,
11
+ "bodyText" : " Fix mdn links" ,
12
+ "labels" : {
13
+ "nodes" : [
14
+ {
15
+ "name" : " doc"
16
+ }
17
+ ]
18
+ },
19
+ "title" : " doc: fix mdn links" ,
20
+ "baseRefName" : " master" ,
21
+ "headRefName" : " fix-links"
22
+ }
Original file line number Diff line number Diff line change 4
4
oddCommits,
5
5
simpleCommits,
6
6
firstTimerPR,
7
- semverMajorPR
7
+ semverMajorPR,
8
+ emptyProfilePR
8
9
} = require ( '../fixtures/data' ) ;
9
10
const TestCLI = require ( '../fixtures/test_cli' ) ;
10
11
const PRSummary = require ( '../../lib/pr_summary' ) ;
@@ -86,4 +87,37 @@ describe('PRSummary', () => {
86
87
summary . display ( ) ;
87
88
cli . assertCalledWith ( expectedLogs ) ;
88
89
} ) ;
90
+
91
+ it ( 'displays warning if pr author/email is not present' , ( ) => {
92
+ const cli = new TestCLI ( ) ;
93
+ const prData = {
94
+ pr : emptyProfilePR ,
95
+ commits : simpleCommits ,
96
+ authorIsNew ( ) {
97
+ return false ;
98
+ }
99
+ } ;
100
+
101
+ const expectedLogs = {
102
+ log : [
103
+ [ ' - doc: some changes' ] ,
104
+ [ ' - Their Github Account email <pr_author@example.com>' ]
105
+ ] ,
106
+ table : [
107
+ [ 'Title' , 'doc: fix mdn links (#16348)' ] ,
108
+ [ 'Branch' , 'pr_author:fix-links -> nodejs:master' ] ,
109
+ [ 'Labels' , 'doc' ] ,
110
+ [ 'Commits' , '1' ] ,
111
+ [ 'Committers' , '1' ]
112
+ ] ,
113
+ warn : [
114
+ [ 'Could not retrieve the email or name ' +
115
+ "of the PR author's from user's GitHub profile!" ]
116
+ ]
117
+ } ;
118
+
119
+ const summary = new PRSummary ( argv , cli , prData ) ;
120
+ summary . display ( ) ;
121
+ cli . assertCalledWith ( expectedLogs ) ;
122
+ } ) ;
89
123
} ) ;
You can’t perform that action at this time.
0 commit comments