diff --git a/packages/shipjs-lib/src/lib/config/defaultConfig.js b/packages/shipjs-lib/src/lib/config/defaultConfig.js index 00a5a7bb..b40ce0df 100644 --- a/packages/shipjs-lib/src/lib/config/defaultConfig.js +++ b/packages/shipjs-lib/src/lib/config/defaultConfig.js @@ -29,6 +29,7 @@ export default { ]; return lines.join('\n'); }, + pullRequestReviewer: undefined, mergeStrategy: { toSameBranch: ['master'], // toReleaseBranch: { diff --git a/packages/shipjs/src/flow/prepare.js b/packages/shipjs/src/flow/prepare.js index 8b7aa257..c0ecf5f9 100644 --- a/packages/shipjs/src/flow/prepare.js +++ b/packages/shipjs/src/flow/prepare.js @@ -326,7 +326,12 @@ function createPullRequest({ dryRun, }) { printStep('Creating a pull-request'); - const { mergeStrategy, formatPullRequestMessage, remote } = config; + const { + mergeStrategy, + formatPullRequestMessage, + pullRequestReviewer, + remote, + } = config; const destinationBranch = getDestinationBranchName({ baseBranch, mergeStrategy, @@ -351,11 +356,17 @@ function createPullRequest({ }); const filePath = tempWrite.sync(message); run(`git remote prune ${remote}`, dir, dryRun); - run( - `hub pull-request --base ${destinationBranch} --browse --push --file ${filePath}`, - dir, - dryRun - ); + const createPullRequestCommand = [ + 'hub pull-request', + `--base ${destinationBranch}`, + '--browse', + '--push', + pullRequestReviewer ? `--reviewer ${pullRequestReviewer}` : undefined, + `--file ${filePath}`, + ] + .filter(Boolean) + .join(' '); + run(createPullRequestCommand, dir, dryRun); run(`cat ${filePath}`, dir); print(''); }