MCPcopy Create free account
hub / github.com/cloudflare/templates / createPR

Function createPR

cli/src/util.ts:313–335  ·  view source on GitHub ↗
({
	githubToken,
	...params
}: CreatePRConfig)

Source from the content-addressed store, hash-verified

311};
312
313export async function createPR({
314 githubToken,
315 ...params
316}: CreatePRConfig): Promise<PR> {
317 const response = await fetchWithRetries(
318 `https://api.github.com/repos/cloudflare/templates/pulls`,
319 {
320 method: "POST",
321 headers: {
322 "Content-Type": "application/json",
323 Authorization: `Bearer ${githubToken}`,
324 Connection: "close",
325 },
326 body: JSON.stringify(params),
327 },
328 );
329 if (!response.ok) {
330 throw new Error(
331 `Error response from GitHub (${response.status}): ${await response.text()}`,
332 );
333 }
334 return (await response.json()) as PR;
335}
336
337export type GetPRByBranchConfig = {
338 githubToken: string;

Callers 1

performUpdatesFunction · 0.90

Calls 3

fetchWithRetriesFunction · 0.85
textMethod · 0.65
jsonMethod · 0.65

Tested by

no test coverage detected