Question about create pull request though API

I have this error

{“message”:“Validation Failed”,“errors”:[{“resource”:“PullRequest”,“code”:“custom”,“field”:“fork_collab”,“message”:“fork_collab Fork collab can’t be granted by someone without permission”}],“documentation_url”:“https://developer.github.com/v3/pulls/#create-a-pull-request”}

What I am trying to do is making a pull request from user1:dev to user2:master.

I am using probot and here is the code:

context.github.pullRequests.create({"owner":"user2","repo":"repoName","title":"159","head":"user1:dev","base":"master"})

I can create the same pull request on the github website. Is there any way I can do it with github API?

If you’re trying to merge user1:dev into user2:master:

  • “owner” should be user2 (the target of the PR)
  • as documented by the API doc, “head” should be “user1:dev”

Though your issues seem related to something else as the error message is talking about fork_collab, I’ve no idea what that is.

Thanks for your answer. It seems that I accidently write my code wrong in the post. I have corrected in the post.