Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 4

createPullRequest API not working

Solved! Go to Solution.

Hey, I've added to my query everything that you indicated a need for in the docs for the GraphQL API's createPullRequestInput, but I'm still getting the following errors:

 

 [data:[createPullRequest:[pullRequest:null]], errors:[[type:UNPROCESSABLE, path:[createPullRequest], locations:[[line:3, column:7]], message:Head sha can't be blank, Base sha can't be blank, No commits between master and CICD-3853_test_branch, Head ref must be a branch]]]

Here's my code for reference:

// query
    mutation createPrForArns {
      createPullRequest(input:{ baseRefName: "master", body: "my test PR body", headRefName: "my-feature-branch", repositoryId: "my-repo-node-id", title: "test" }) {
        pullRequest {
          resourcePath
        }
      }
    }

Any help around this would be highly appreciated.

 

P.S. It would be really helpful to have examples for the mutations in your API documentation. Thanks.

3 Replies
Highlighted
Copilot Lvl 3
Message 2 of 4

Re: createPullRequest API not working

By the way, there is a commit between the testing branch and the base branch of master - I added a test commit and pushed it up to the testing branch. 

Highlighted
Solution
Pilot Lvl 1
Message 3 of 4

Re: createPullRequest API not working

@cjiang-ias 

 

This is working fine for me.

What is the error message that you are getting?

Also, is your testing branch pushed to the origin or it is a local branch?

 

 

mutation {
	createPullRequest(input: {
		repositoryId: "X-X-X-X",
		baseRefName: "master",
		title: "Pull request from github V4",
		headRefName: "parithibang-patch-3"
	}) {
		pullRequest {
			body
			title
		}
	}
}

 

 

 

Screen Shot 2020-02-24 at 6.49.32 PM.png

 

Highlighted
Copilot Lvl 3
Message 4 of 4

Re: createPullRequest API not working

Thanks for following up, @parithiban. Turns out it was just the wrong repo ID. The mutation indeed works.