Checks whether a given branch name is reserved in the specified repository.
(repo: GithubRepo, name: string)
| 268 | |
| 269 | /** Checks whether a given branch name is reserved in the specified repository. */ |
| 270 | private async _isBranchNameReservedInRepo(repo: GithubRepo, name: string): Promise<boolean> { |
| 271 | try { |
| 272 | await this.git.github.repos.getBranch({owner: repo.owner, repo: repo.name, branch: name}); |
| 273 | return true; |
| 274 | } catch (e) { |
| 275 | // If the error has a `status` property set to `404`, then we know that the branch |
| 276 | // does not exist. Otherwise, it might be an API error that we want to report/re-throw. |
| 277 | if (isGithubApiError(e) && e.status === 404) { |
| 278 | return false; |
| 279 | } |
| 280 | throw e; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /** Finds a non-reserved branch name in the repository with respect to a base name. */ |
| 285 | private async _findAvailableBranchName(repo: GithubRepo, baseName: string): Promise<string> { |
nothing calls this directly
no test coverage detected