Skip to content

Commit 154e50e

Browse files
authored
Merge pull request hub4j#499 from anatolyD/feature/let-create-pr-to-org-fork
Create PR from original repo to private org fork
2 parents 80a1291 + 615e4cf commit 154e50e

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

src/main/java/org/kohsuke/github/GHRepository.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,36 @@ public GHPullRequestQueryBuilder queryPullRequests() {
758758
* of a pull request.
759759
*/
760760
public GHPullRequest createPullRequest(String title, String head, String base, String body) throws IOException {
761+
return createPullRequest(title, head, base, body, true);
762+
}
763+
764+
/**
765+
* Creates a new pull request. Maintainer's permissions aware.
766+
*
767+
* @param title
768+
* Required. The title of the pull request.
769+
* @param head
770+
* Required. The name of the branch where your changes are implemented.
771+
* For cross-repository pull requests in the same network,
772+
* namespace head with a user like this: username:branch.
773+
* @param base
774+
* Required. The name of the branch you want your changes pulled into.
775+
* This should be an existing branch on the current repository.
776+
* @param body
777+
* The contents of the pull request. This is the markdown description
778+
* of a pull request.
779+
* @param maintainerCanModify
780+
* Indicates whether maintainers can modify the pull request.
781+
*/
782+
public GHPullRequest createPullRequest(String title, String head, String base, String body,
783+
boolean maintainerCanModify) throws IOException {
761784
return new Requester(root).with("title",title)
762785
.with("head",head)
763786
.with("base",base)
764-
.with("body",body).to(getApiTailUrl("pulls"),GHPullRequest.class).wrapUp(this);
787+
.with("body",body)
788+
.with("maintainer_can_modify", maintainerCanModify)
789+
.to(getApiTailUrl("pulls"),GHPullRequest.class)
790+
.wrapUp(this);
765791
}
766792

767793
/**

0 commit comments

Comments
 (0)