MCPcopy Create free account
hub / github.com/decaporg/decap-cms / createPR

Method createPR

packages/decap-cms-backend-github/src/GraphQLAPI.ts:604–632  ·  view source on GitHub ↗
(title: string, head: string)

Source from the content-addressed store, hash-verified

602 }
603
604 async createPR(title: string, head: string) {
605 const [repository, headReference] = await Promise.all([
606 this.getRepository(this.originRepoOwner, this.originRepoName),
607 this.useOpenAuthoring ? `${(await this.user()).login}:${head}` : head,
608 ]);
609 const { data } = await this.mutate({
610 mutation: mutations.createPullRequest,
611 variables: {
612 createPullRequestInput: {
613 baseRefName: this.branch,
614 body: DEFAULT_PR_BODY,
615 title,
616 headRefName: headReference,
617 repositoryId: repository.id,
618 },
619 },
620 update: (store, { data: mutationResult }) => {
621 const { pullRequest } = mutationResult!.createPullRequest;
622 const pullRequestData = { repository: { ...pullRequest.repository, pullRequest } };
623
624 store.writeQuery({
625 ...this.getPullRequestQuery(pullRequest.number),
626 data: pullRequestData,
627 });
628 },
629 });
630 const { pullRequest } = data!.createPullRequest;
631 return { ...pullRequest, head: { sha: pullRequest.headRefOid } };
632 }
633
634 async createBranch(branchName: string, sha: string) {
635 const owner = this.repoOwner;

Callers

nothing calls this directly

Calls 4

getRepositoryMethod · 0.95
userMethod · 0.95
mutateMethod · 0.95
getPullRequestQueryMethod · 0.95

Tested by

no test coverage detected