Skip to content

Commit

Permalink
feat(prepare): provide a config to assign team as reviewer (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunjae Lee authored Jan 14, 2020
1 parent 8c92df2 commit 14ebf38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/shipjs-lib/src/lib/config/defaultConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
return lines.join('\n');
},
pullRequestReviewer: undefined,
pullRequestTeamReviewer: undefined,
mergeStrategy: {
toSameBranch: ['master'],
// toReleaseBranch: {
Expand Down
5 changes: 5 additions & 0 deletions packages/shipjs/src/step/prepare/createPullRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default async ({
formatPullRequestMessage,
publishCommand,
pullRequestReviewer,
pullRequestTeamReviewer,
remote,
monorepo,
} = config;
Expand Down Expand Up @@ -87,6 +88,9 @@ export default async ({
const reviewers = Array.isArray(pullRequestReviewer)
? pullRequestReviewer
: (pullRequestReviewer || '').split(',');
const teamReviewers = Array.isArray(pullRequestTeamReviewer)
? pullRequestTeamReviewer
: (pullRequestTeamReviewer || '').split(',');
const octokit = new Octokit({
auth: `token ${process.env.GITHUB_TOKEN}`,
});
Expand All @@ -107,6 +111,7 @@ export default async ({
repo,
pull_number: number, // eslint-disable-line camelcase
reviewers,
team_reviewers: teamReviewers, // eslint-disable-line camelcase
});
}

Expand Down
11 changes: 9 additions & 2 deletions website/guide/useful-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,16 @@ You can assign reviewers on the PR.

```js
module.exports = {
pullRequestReviewer: "user-name-or-team-name"
pullRequestReviewer: "user-login"
// or
pullRequestReviewer: ["user1", "user2", "user3"]
pullRequestReviewer: ["user-login1", "user-login2", "user-login3"],
...
// also
pullRequestTeamReviewer: "team-slug",
// or
pullRequestTeamReviewer: ["team-slug1", "team-slug2"],
};
```

Expand Down

0 comments on commit 14ebf38

Please sign in to comment.