-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Octokit } from '@octokit/rest'; | ||
import ora from 'ora'; | ||
import { ValidConfigOptions } from '../../../options/options'; | ||
import { logger } from '../../logger'; | ||
|
||
export async function addReviewersToPullRequest( | ||
{ githubApiBaseUrlV3, repoName, repoOwner, accessToken }: ValidConfigOptions, | ||
pullNumber: number, | ||
reviewers: string[] | ||
) { | ||
const text = `Adding reviewers: ${reviewers}`; | ||
logger.info(text); | ||
const spinner = ora(text).start(); | ||
|
||
try { | ||
const octokit = new Octokit({ | ||
auth: accessToken, | ||
baseUrl: githubApiBaseUrlV3, | ||
log: logger, | ||
}); | ||
|
||
await octokit.pulls.requestReviewers({ | ||
owner: repoOwner, | ||
repo: repoName, | ||
pull_number: pullNumber, | ||
reviewers, | ||
}); | ||
|
||
spinner.succeed(); | ||
} catch (e) { | ||
const message = e.response?.data?.message; | ||
spinner.fail(`Adding reviewers. ${message ? message : ''}`); | ||
logger.info(`Could not add reviewers to PR ${pullNumber}`, e.stack); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters