* Creates the pull request merge tool using the given configuration options. * * Explicit configuration options can be specified when the merge script is used * outside of an `ng-dev` configured repository.
(flags: PullRequestMergeFlags)
| 124 | * outside of an `ng-dev` configured repository. |
| 125 | */ |
| 126 | async function createPullRequestMergeTool(flags: PullRequestMergeFlags) { |
| 127 | try { |
| 128 | const config = await getConfig(); |
| 129 | |
| 130 | assertValidGithubConfig(config); |
| 131 | assertValidPullRequestConfig(config); |
| 132 | |
| 133 | /** The singleton instance of the authenticated git client. */ |
| 134 | const git = await AuthenticatedGitClient.get(); |
| 135 | return new MergeTool(config, git, flags); |
| 136 | } catch (e) { |
| 137 | if (e instanceof ConfigValidationError) { |
| 138 | if (e.errors.length) { |
| 139 | Log.error('Invalid merge configuration:'); |
| 140 | e.errors.forEach((desc) => Log.error(` - ${desc}`)); |
| 141 | } else { |
| 142 | Log.error(e.message); |
| 143 | } |
| 144 | process.exit(1); |
| 145 | } |
| 146 | throw e; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Parses the pull request number from either the number or url string |
no test coverage detected