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

Function parsePrNumber

ng-dev/pr/merge/merge-pull-request.ts:153–162  ·  view source on GitHub ↗
(prUrlOrNumber: string)

Source from the content-addressed store, hash-verified

151 * Parses the pull request number from either the number or url string
152 */
153export function parsePrNumber(prUrlOrNumber: string): number {
154 // There is no url validation here other than presence of `/`.
155 // So whatever is the last segment of that string, url or not, will be
156 // parsed as a PR number.
157 const prNumber = parseInt(prUrlOrNumber.split('/').pop()!);
158 if (isNaN(prNumber)) {
159 throw new Error('Pull Request was unable to be parsed from the parameters');
160 }
161 return prNumber;
162}

Callers 2

builderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected