MCPcopy Create free account
hub / github.com/angular/dev-infra / _isBranchNameReservedInRepo

Function _isBranchNameReservedInRepo

ng-dev/release/publish/actions.ts:270–282  ·  view source on GitHub ↗

Checks whether a given branch name is reserved in the specified repository.

(repo: GithubRepo, name: string)

Source from the content-addressed store, hash-verified

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> {

Callers

nothing calls this directly

Calls 1

isGithubApiErrorFunction · 0.85

Tested by

no test coverage detected