export async function getPrPackageVersion()

in on-merge/util.ts [6:23]


export async function getPrPackageVersion(
  github: Octokit['rest'],
  repoOwner: string,
  repoName: string,
  ref: string,
) {
  const { data } = await github.repos.getContent({
    owner: repoOwner,
    repo: repoName,
    ref: ref,
    path: 'package.json',
  });

  const json = Buffer.from((data as any).content, 'base64').toString();
  const { version } = JSON.parse(json) as { version: string };

  return version;
}