(prUrlOrNumber: string)
| 151 | * Parses the pull request number from either the number or url string |
| 152 | */ |
| 153 | export 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 | } |
no outgoing calls
no test coverage detected