@@ -13,22 +13,8 @@ async function processIssueComment({ context, commentReply }) {
1313
1414 const { action, contributors } = parseComment ( commentBody ) ;
1515
16- const log = context . log . child ( {
17- action,
18- contributors,
19- account : repo . owner . id ,
20- accountType : repo . owner . type . toLowerCase ( ) ,
21- accountLogin : repo . owner . login ,
22- createdBy : createdBy . id ,
23- createdByLogin : createdBy . login ,
24- createdByType : createdBy . type . toLowerCase ( ) ,
25- repository : repo . id ,
26- private : repo . private ,
27- success : false ,
28- } ) ;
29-
3016 if ( action !== "add" ) {
31- log . info ( `Unknown action "${ action } "` ) ;
17+ context . log . info ( `Unknown action "${ action } "` ) ;
3218 commentReply . reply ( `I could not determine your intention.` ) ;
3319 commentReply . reply (
3420 `Basic usage: @all-contributors please add @someone for code, doc and infra`
@@ -40,15 +26,44 @@ async function processIssueComment({ context, commentReply }) {
4026 }
4127
4228 for ( var contributor in contributors ) {
43- const who = contributor
44- const contributions = contributors [ who ]
29+ const who = contributor ;
30+ const contributions = contributors [ who ] ;
4531 const branchName = `all-contributors/add-${ toSafeGitReferenceName ( who ) } ` ;
4632
47- await triggerActionAdd ( context , commentReply , log , who , contributions , branchName )
33+ const log = context . log . child ( {
34+ who,
35+ action,
36+ contributions,
37+ account : repo . owner . id ,
38+ accountType : repo . owner . type . toLowerCase ( ) ,
39+ accountLogin : repo . owner . login ,
40+ createdBy : createdBy . id ,
41+ createdByLogin : createdBy . login ,
42+ createdByType : createdBy . type . toLowerCase ( ) ,
43+ repository : repo . id ,
44+ private : repo . private ,
45+ success : false ,
46+ } ) ;
47+
48+ await triggerActionAdd (
49+ context ,
50+ commentReply ,
51+ log ,
52+ who ,
53+ contributions ,
54+ branchName
55+ ) ;
4856 }
4957}
5058
51- async function triggerActionAdd ( context , commentReply , log , who , contributions , branchName ) {
59+ async function triggerActionAdd (
60+ context ,
61+ commentReply ,
62+ log ,
63+ who ,
64+ contributions ,
65+ branchName
66+ ) {
5267 if ( contributions . length === 0 ) {
5368 log . info ( "No contributions" ) ;
5469 commentReply . reply (
@@ -77,13 +92,13 @@ async function triggerActionAdd(context, commentReply, log, who, contributions,
7792 branchName,
7893 } ) ;
7994
80- if ( ! pullCreated ) {
95+ if ( ! pullCreated ) {
8196 log . info (
82- {
83- pullCreated,
84- success : true ,
85- } ,
86- `${ who } already have ${ contributions . join ( ", " ) } `
97+ {
98+ pullCreated,
99+ success : true ,
100+ } ,
101+ `${ who } already have ${ contributions . join ( ", " ) } `
87102 ) ;
88103 return ;
89104 }
0 commit comments