(pr: WebHookPR, checkNotBot = false)
| 269 | }; |
| 270 | |
| 271 | export const getPRNumbersFromPRBody = (pr: WebHookPR, checkNotBot = false) => { |
| 272 | const backportNumbers: number[] = []; |
| 273 | |
| 274 | const isBot = pr.user.login === getEnvVar('BOT_USER_NAME'); |
| 275 | if (checkNotBot && isBot) return backportNumbers; |
| 276 | |
| 277 | let match: RegExpExecArray | null; |
| 278 | const backportPattern = getBackportPattern(); |
| 279 | while ((match = backportPattern.exec(pr.body || ''))) { |
| 280 | // This might be the first or second capture group depending on if it's a link or not. |
| 281 | backportNumbers.push( |
| 282 | match[1] ? parseInt(match[1], 10) : parseInt(match[2], 10), |
| 283 | ); |
| 284 | } |
| 285 | |
| 286 | return backportNumbers; |
| 287 | }; |
| 288 | |
| 289 | /** |
| 290 | * |
no test coverage detected