MCPcopy Create free account
hub / github.com/backnotprop/plannotator / queryPRsByRef

Function queryPRsByRef

packages/shared/pr-github.ts:697–715  ·  view source on GitHub ↗
(
  runtime: PRRuntime,
  ref: GhPRRef,
  kind: "head" | "base",
  refName: string,
)

Source from the content-addressed store, hash-verified

695}
696
697async function queryPRsByRef(
698 runtime: PRRuntime,
699 ref: GhPRRef,
700 kind: "head" | "base",
701 refName: string,
702): Promise<StackPRNode[]> {
703 const varName = kind === "head" ? "headRefName" : "baseRefName";
704 const result = await runtime.runCommand("gh", hostnameArgs(ref.host, [
705 "api", "graphql",
706 "-f", `query=${stackPRQuery(kind)}`,
707 "-f", `owner=${ref.owner}`,
708 "-f", `repo=${ref.repo}`,
709 "-f", `${varName}=${refName}`,
710 ]));
711 if (result.exitCode !== 0) return [];
712 const data = JSON.parse(result.stdout);
713 const prs = data?.data?.repository?.pullRequests?.nodes;
714 return Array.isArray(prs) ? prs : [];
715}
716
717/**
718 * Walk up and down the PR stack from the current PR, resolving

Callers 1

fetchGhPRStackFunction · 0.85

Calls 3

hostnameArgsFunction · 0.85
stackPRQueryFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected