@@ -86,7 +86,7 @@ async function _removeAssignees(github, owner, repo, number, assignees) {
86
86
* @returns {string } username if found
87
87
*/
88
88
async function _getUsernameById ( github , id ) {
89
- const user = await github . users . getById ( { id } ) ;
89
+ const user = await github . users . getById ( { id } ) ;
90
90
return user ? user . data . login : null ;
91
91
}
92
92
@@ -98,11 +98,11 @@ async function _getUsernameById(github, id) {
98
98
* @param {string } title new title
99
99
*/
100
100
async function updateIssue ( copilot , repoFullName , number , title ) {
101
- Joi . attempt ( { copilot, repoFullName, number, title } , updateIssue . schema ) ;
101
+ Joi . attempt ( { copilot, repoFullName, number, title} , updateIssue . schema ) ;
102
102
const github = await _authenticate ( copilot . accessToken ) ;
103
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
103
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
104
104
try {
105
- await github . issues . edit ( { owner, repo, number, title } ) ;
105
+ await github . issues . edit ( { owner, repo, number, title} ) ;
106
106
} catch ( err ) {
107
107
throw errors . convertGitHubError ( err , 'Error occurred during updating issue.' ) ;
108
108
}
@@ -124,17 +124,17 @@ updateIssue.schema = {
124
124
* @param {string } user the user login of assignee
125
125
*/
126
126
async function assignUser ( copilot , repoFullName , number , user ) {
127
- Joi . attempt ( { copilot, repoFullName, number, user } , assignUser . schema ) ;
127
+ Joi . attempt ( { copilot, repoFullName, number, user} , assignUser . schema ) ;
128
128
const github = await _authenticate ( copilot . accessToken ) ;
129
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
129
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
130
130
try {
131
- const issue = await github . issues . get ( { owner, repo, number } ) ;
131
+ const issue = await github . issues . get ( { owner, repo, number} ) ;
132
132
133
133
const oldAssignees = _ ( issue . data . assignees ) . map ( 'login' ) . without ( user ) . value ( ) ;
134
134
if ( oldAssignees && oldAssignees . length > 0 ) {
135
135
await _removeAssignees ( github , owner , repo , number , oldAssignees ) ;
136
136
}
137
- await github . issues . addAssigneesToIssue ( { owner, repo, number, assignees : [ user ] } ) ;
137
+ await github . issues . addAssigneesToIssue ( { owner, repo, number, assignees : [ user ] } ) ;
138
138
} catch ( err ) {
139
139
throw errors . convertGitHubError ( err , 'Error occurred during assigning issue user.' ) ;
140
140
}
@@ -156,10 +156,10 @@ assignUser.schema = {
156
156
* @param {string } user the user login of assignee
157
157
*/
158
158
async function removeAssign ( copilot , repoFullName , number , user ) {
159
- Joi . attempt ( { copilot, repoFullName, number, user } , removeAssign . schema ) ;
159
+ Joi . attempt ( { copilot, repoFullName, number, user} , removeAssign . schema ) ;
160
160
161
161
const github = await _authenticate ( copilot . accessToken ) ;
162
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
162
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
163
163
await _removeAssignees ( github , owner , repo , number , [ user ] ) ;
164
164
logger . debug ( `Github user ${ user } is unassigned from issue number ${ number } ` ) ;
165
165
}
@@ -174,12 +174,12 @@ removeAssign.schema = assignUser.schema;
174
174
* @param {string } body the comment body text
175
175
*/
176
176
async function createComment ( copilot , repoFullName , number , body ) {
177
- Joi . attempt ( { copilot, repoFullName, number, body } , createComment . schema ) ;
177
+ Joi . attempt ( { copilot, repoFullName, number, body} , createComment . schema ) ;
178
178
const github = await _authenticate ( copilot . accessToken ) ;
179
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
179
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
180
180
try {
181
181
body = helper . prepareAutomatedComment ( body , copilot ) ;
182
- await github . issues . createComment ( { owner, repo, number, body } ) ;
182
+ await github . issues . createComment ( { owner, repo, number, body} ) ;
183
183
} catch ( err ) {
184
184
throw errors . convertGitHubError ( err , 'Error occurred during creating comment on issue.' ) ;
185
185
}
@@ -200,7 +200,7 @@ createComment.schema = {
200
200
* @returns {string } the username if found else null
201
201
*/
202
202
async function getUsernameById ( copilot , userId ) {
203
- Joi . attempt ( { copilot, userId } , getUsernameById . schema ) ;
203
+ Joi . attempt ( { copilot, userId} , getUsernameById . schema ) ;
204
204
const github = await _authenticate ( copilot . accessToken ) ;
205
205
const login = await _getUsernameById ( github , userId ) ;
206
206
return login ;
@@ -218,9 +218,9 @@ getUsernameById.schema = {
218
218
* @returns {Number } the user id if found else null
219
219
*/
220
220
async function getUserIdByLogin ( copilot , login ) {
221
- Joi . attempt ( { copilot, login } , getUserIdByLogin . schema ) ;
221
+ Joi . attempt ( { copilot, login} , getUserIdByLogin . schema ) ;
222
222
const github = await _authenticate ( copilot . accessToken ) ;
223
- const user = await github . users . getForUser ( { username : login } ) ;
223
+ const user = await github . users . getForUser ( { username : login } ) ;
224
224
return user . data ? user . data . id : null ;
225
225
}
226
226
@@ -243,11 +243,11 @@ getUserIdByLogin.schema = {
243
243
async function markIssueAsPaid ( copilot , repoFullName , number , challengeUUID , existLabels , winner , createCopilotPayments ) { // eslint-disable-line max-params
244
244
Joi . attempt ( { copilot, repoFullName, number, challengeUUID, existLabels, winner, createCopilotPayments} , markIssueAsPaid . schema ) ;
245
245
const github = await _authenticate ( copilot . accessToken ) ;
246
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
246
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
247
247
const labels = _ ( existLabels ) . filter ( ( i ) => i !== config . FIX_ACCEPTED_ISSUE_LABEL )
248
248
. push ( config . FIX_ACCEPTED_ISSUE_LABEL , config . PAID_ISSUE_LABEL ) . value ( ) ;
249
249
try {
250
- await github . issues . edit ( { owner, repo, number, labels } ) ;
250
+ await github . issues . edit ( { owner, repo, number, labels} ) ;
251
251
let commentMessage = '' ;
252
252
commentMessage += `Payment task has been updated: ${ config . TC_URL } /challenges/${ challengeUUID } \n` ;
253
253
commentMessage += '*Payments Complete*\n' ;
@@ -283,11 +283,11 @@ markIssueAsPaid.schema = {
283
283
* @param {string } state new state
284
284
*/
285
285
async function changeState ( copilot , repoFullName , number , state ) {
286
- Joi . attempt ( { copilot, repoFullName, number, state } , changeState . schema ) ;
286
+ Joi . attempt ( { copilot, repoFullName, number, state} , changeState . schema ) ;
287
287
const github = await _authenticate ( copilot . accessToken ) ;
288
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
288
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
289
289
try {
290
- await github . issues . edit ( { owner, repo, number, state } ) ;
290
+ await github . issues . edit ( { owner, repo, number, state} ) ;
291
291
} catch ( err ) {
292
292
throw errors . convertGitHubError ( err , 'Error occurred during updating status of issue.' ) ;
293
293
}
@@ -309,11 +309,11 @@ changeState.schema = {
309
309
* @param {Number } labels the challenge id
310
310
*/
311
311
async function addLabels ( copilot , repoFullName , number , labels ) {
312
- Joi . attempt ( { copilot, repoFullName, number, labels } , addLabels . schema ) ;
312
+ Joi . attempt ( { copilot, repoFullName, number, labels} , addLabels . schema ) ;
313
313
const github = await _authenticate ( copilot . accessToken ) ;
314
- const { owner, repo } = _parseRepoUrl ( repoFullName ) ;
314
+ const { owner, repo} = _parseRepoUrl ( repoFullName ) ;
315
315
try {
316
- await github . issues . edit ( { owner, repo, number, labels } ) ;
316
+ await github . issues . edit ( { owner, repo, number, labels} ) ;
317
317
} catch ( err ) {
318
318
throw errors . convertGitHubError ( err , 'Error occurred during adding label in issue.' ) ;
319
319
}
0 commit comments