MCPcopy Create free account
hub / github.com/electron/trop / getPRNumbersFromPRBody

Function getPRNumbersFromPRBody

src/utils.ts:271–287  ·  view source on GitHub ↗
(pr: WebHookPR, checkNotBot = false)

Source from the content-addressed store, hash-verified

269};
270
271export 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 *

Callers 3

probotHandlerFunction · 0.90
labelClosedPRFunction · 0.85
backportImplFunction · 0.85

Calls 2

getEnvVarFunction · 0.90
getBackportPatternFunction · 0.90

Tested by

no test coverage detected