@@ -292,29 +292,6 @@ class GitHub {
292292 ) ;
293293 }
294294
295- /**
296- * Requests a review from GitHub users.
297- *
298- * @param {number } number PR number.
299- * @param {!Array<string> } reviewers the list of usernames to request reviews from.
300- */
301- async createReviewRequests ( number , reviewers ) {
302- if ( ! reviewers . length ) {
303- this . logger . warn (
304- `Attempted to request reviews for PR ${ number } ` +
305- 'but provided an empty username list'
306- ) ;
307- return ;
308- }
309- this . logger . info (
310- `Requesting review for PR #${ number } from: ${ reviewers . join ( ', ' ) } `
311- ) ;
312-
313- await this . client . pulls . requestReviewers (
314- this . repo ( { 'pull_number' : number , reviewers} )
315- ) ;
316- }
317-
318295 /**
319296 * Retrieves code review requests for a PR from GitHub.
320297 *
@@ -332,83 +309,6 @@ class GitHub {
332309 return response . data . users . map ( ( { login} ) => login . toLowerCase ( ) ) ;
333310 }
334311
335- /**
336- * Retrieves PR comments by the bot user.
337- *
338- * Note that pull request comments fall under the Issues API, while comments
339- * created via the Pulls API require a file path/position.
340- *
341- * @param {number } number PR number.
342- * @return {!Array<{body: string, id: number}> } list of comments by the bot.
343- */
344- async getBotComments ( number ) {
345- this . logger . info ( `Fetching bot comments for PR #${ number } ` ) ;
346-
347- const comments = await this . _paginate (
348- this . client . issues . listComments ,
349- this . repo ( { 'issue_number' : number } )
350- ) ;
351- this . logger . debug ( '[getBotComments]' , number , comments ) ;
352-
353- // GitHub appears to respond with the bot's username suffixed by `[bot]`,
354- // though this doesn't appear to be documented anywhere. Since it's not
355- // documented, rather than testing for that suffix explicitly, we just test
356- // for the presence of the username and ignore whatever extras GitHub tacks
357- // on.
358- const regex = new RegExp ( `\\b${ process . env . GITHUB_BOT_USERNAME } \\b` ) ;
359- return comments
360- . filter ( ( { user} ) => regex . test ( user . login ) )
361- . map ( ( { id, body} ) => {
362- return { id, body} ;
363- } ) ;
364- }
365-
366- /**
367- * Creates a comment on a PR.
368- *
369- * Note that pull request comments fall under the Issues API, while comments
370- * created via the Pulls API require a file path/position.
371- *
372- * @param {number } number PR number.
373- * @param {string } body comment body.
374- * @return {Object } API response
375- */
376- async createBotComment ( number , body ) {
377- this . logger . info ( `Adding bot comment to PR #${ number } ` ) ;
378- this . logger . debug ( '[createBotComment]' , number , body ) ;
379-
380- const { data} = await this . _customRequest (
381- 'POST' ,
382- `/repos/${ this . owner } /${ this . repository } /issues/${ number } /comments` ,
383- { body}
384- ) ;
385-
386- return data ;
387- }
388-
389- /**
390- * Updates a comment on a PR.
391- *
392- * Note that pull request comments fall under the Issues API, while comments
393- * created via the Pulls API require a file path/position.
394- *
395- * @param {number } commentId ID of comment to update.
396- * @param {string } body comment body.
397- * @return {Object } API response
398- */
399- async updateComment ( commentId , body ) {
400- this . logger . info ( `Replacing comment with ID ${ commentId } ` ) ;
401- this . logger . debug ( '[updateComment]' , commentId , body ) ;
402-
403- const { data} = await this . _customRequest (
404- 'PATCH' ,
405- `/repos/${ this . owner } /${ this . repository } /issues/comments/${ commentId } ` ,
406- { body}
407- ) ;
408-
409- return data ;
410- }
411-
412312 /**
413313 * Fetches the contents of a file from GitHub.
414314 *
0 commit comments