MCPcopy Index your code
hub / github.com/wei/pull / isMergeable

Method isMergeable

src/processor/pull.ts:392–423  ·  view source on GitHub ↗
(
    prNumber: number,
    config: { maxRetries?: number } = {},
  )

Source from the content-addressed store, hash-verified

390 }
391
392 private async isMergeable(
393 prNumber: number,
394 config: { maxRetries?: number } = {},
395 ): Promise<PullRequestData | null> {
396 const maxRetries = config.maxRetries || 3;
397 let attempts = 0;
398
399 while (attempts++ < maxRetries) {
400 const pr = await this.github.pulls.get({
401 owner: this.owner,
402 repo: this.repo,
403 pull_number: prNumber,
404 });
405
406 this.logger.debug(
407 `#${prNumber} Mergeability is ${pr.data.mergeable_state}`,
408 );
409
410 if (
411 typeof pr.data.mergeable === "boolean" &&
412 pr.data.mergeable_state !== "unknown"
413 ) {
414 return pr.data.mergeable && pr.data.mergeable_state === "clean"
415 ? pr.data
416 : null;
417 }
418
419 // Wait a bit to see if the mergeable state changes
420 await timeout(4500);
421 }
422 return null;
423 }
424
425 private async addReviewers(
426 prNumber: number | undefined,

Callers 1

getMergeableStatusMethod · 0.95

Calls 1

timeoutFunction · 0.90

Tested by

no test coverage detected