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

Method createPR

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

Source from the content-addressed store, hash-verified

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