MCPcopy Create free account
hub / github.com/SIMARSINGHRAYAT/Gitzo / requestPRReview

Function requestPRReview

src/utils/github.ts:461–483  ·  view source on GitHub ↗
(
  token: string,
  owner: string,
  repo: string,
  pullNumber: number,
  reviewers: string[]
)

Source from the content-addressed store, hash-verified

459}
460
461export async function requestPRReview(
462 token: string,
463 owner: string,
464 repo: string,
465 pullNumber: number,
466 reviewers: string[]
467) {
468 if (reviewers.length === 0) return;
469 const res = await ghFetch(`/repos/${owner}/${repo}/pulls/${pullNumber}/requested_reviewers`, token, {
470 method: 'POST',
471 body: JSON.stringify({ reviewers }),
472 headers: { 'Content-Type': 'application/json' },
473 });
474
475 if (!res.ok) {
476 const err = await res.json().catch(() => ({ message: res.statusText }));
477 if (res.status === 422) {
478 throw new Error(`Failed to request review. Make sure ${reviewers.join(', ')} is a valid collaborator and not yourself.`);
479 }
480 throw new Error(`Failed to request review: ${err.message || `HTTP ${res.status}`}`);
481 }
482 return res.json();
483}
484
485/**
486 * Wait for a PR to become mergeable by polling its status.

Callers 1

startYOLOBadgeWorkflowFunction · 0.90

Calls 1

ghFetchFunction · 0.85

Tested by

no test coverage detected