Package org.kohsuke.github
Class GHPullRequest
java.lang.Object
org.kohsuke.github.GHObject
org.kohsuke.github.GHIssue
org.kohsuke.github.GHPullRequest
- All Implemented Interfaces:
Reactable,Refreshable
A pull request.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe status of auto merging a GHPullRequest.static enumThe enum MergeMethod.Nested classes/interfaces inherited from class org.kohsuke.github.GHIssue
GHIssue.PullRequest -
Field Summary
Fields inherited from class org.kohsuke.github.GHIssue
assignee, assignees, body, closed_at, closed_by, comments, html_url, labels, locked, milestone, number, pull_request, state, state_reason, title, userFields inherited from class org.kohsuke.github.GHObject
responseHeaderFields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCan maintainer modify boolean.Create review gh pull request review builder.createReview(String body, GHPullRequestReviewState event, List<GHPullRequestReviewComment> comments) Deprecated.createReview(String body, GHPullRequestReviewState event, GHPullRequestReviewComment... comments) Deprecated.UsecreateReview()Create gh pull request review comment builder.createReviewComment(String body, String sha, String path, int position) Deprecated.intGets additions.protected StringGets the api route.The status of auto merging a pull request.getBase()This points to where the change should be pulled into, but I'm not really sure what exactly it means.intGets changed files.Gets the closed by.intGets the number of commits.intGets deletions.The diff file, like https://github.com/jenkinsci/jenkins/pull/100.diffgetHead()The change that should be pulled.Deprecated.The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patchIs this PR mergeable?.Gets mergeable state.See GitHub blog postGets merged at.Gets merged by.The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patchGets the pull request.Gets requested reviewers.Gets requested teams.intGets review comments.getRoot()Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.booleanisDraft()Is draft boolean.booleanisMerged()Is merged boolean.Retrieves all the commits associated to this pull request.Retrieves all the files associated to this pull request.Obtains all the review comments associated with this pull request.Retrieves all the reviews associated to this pull request.voidMerge this pull request.voidMerge this pull request.voidmerge(String msg, String sha, GHPullRequest.MergeMethod method) Merge this pull request, using the specified merge method.voidrefresh()Repopulates this object.voidrequestReviewers(List<GHUser> reviewers) Request reviewers.voidrequestTeamReviewers(List<GHTeam> teams) Request team reviewers.setBaseBranch(String newBaseBranch) Set the base branch on the pull request.voidUpdates the branch.Methods inherited from class org.kohsuke.github.GHIssue
addAssignees, addAssignees, addLabels, addLabels, addLabels, assignTo, close, close, comment, createReaction, deleteReaction, getApiURL, getAssignee, getAssignees, getBody, getClosedAt, getComments, getCommentsCount, getHtmlUrl, getIssuesApiRoute, getLabels, getLogins, getMilestone, getNumber, getRepository, getState, getStateReason, getTitle, getUser, isLocked, isPullRequest, listComments, listEvents, listReactions, lock, queryComments, removeAssignees, removeAssignees, removeLabel, removeLabels, removeLabels, removeLabels, reopen, setAssignees, setAssignees, setBody, setLabels, setMilestone, setTitle, unlockMethods inherited from class org.kohsuke.github.GHObject
getCreatedAt, getId, getNodeId, getResponseHeaderFields, getUpdatedAt, getUrl, setResponseHeaderFields, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kohsuke.github.Refreshable
refresh
-
Constructor Details
-
GHPullRequest
public GHPullRequest()Create default GHPullRequest instance
-
-
Method Details
-
getApiRoute
Gets the api route.- Overrides:
getApiRoutein classGHIssue- Returns:
- the api route
-
getAutoMerge
The status of auto merging a pull request.- Returns:
- the GHPullRequest.AutoMerge or
nullif no auto merge is set.
-
getPatchUrl
The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch- Returns:
- the patch url
-
getIssueUrl
The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch- Returns:
- the issue url
-
getBase
This points to where the change should be pulled into, but I'm not really sure what exactly it means.- Returns:
- the base
-
getHead
The change that should be pulled. The tip of the commits to merge.- Returns:
- the head
-
getIssueUpdatedAt
Deprecated.Gets issue updated at.- Returns:
- the issue updated at
- Throws:
IOException- the io exception
-
getDiffUrl
The diff file, like https://github.com/jenkinsci/jenkins/pull/100.diff- Returns:
- the diff url
-
getMergedAt
Gets merged at.- Returns:
- the merged at
-
getClosedBy
Gets the closed by.- Overrides:
getClosedByin classGHIssue- Returns:
- the closed by
-
getPullRequest
Gets the pull request.- Overrides:
getPullRequestin classGHIssue- Returns:
- the pull request
-
getMergedBy
Gets merged by.- Returns:
- the merged by
- Throws:
IOException- the io exception
-
getReviewComments
Gets review comments.- Returns:
- the review comments
- Throws:
IOException- the io exception
-
getAdditions
Gets additions.- Returns:
- the additions
- Throws:
IOException- the io exception
-
getCommits
Gets the number of commits.- Returns:
- the number of commits
- Throws:
IOException- the io exception
-
isMerged
Is merged boolean.- Returns:
- the boolean
- Throws:
IOException- the io exception
-
canMaintainerModify
Can maintainer modify boolean.- Returns:
- the boolean
- Throws:
IOException- the io exception
-
isDraft
Is draft boolean.- Returns:
- the boolean
- Throws:
IOException- the io exception
-
getMergeable
Is this PR mergeable?.- Returns:
- null if the state has not been determined yet, for example when a PR is newly created. If this method is called on an instance whose mergeable state is not yet known, API call is made to retrieve the latest state.
- Throws:
IOException- the io exception
-
getDeletions
Gets deletions.- Returns:
- the deletions
- Throws:
IOException- the io exception
-
getMergeableState
Gets mergeable state.- Returns:
- the mergeable state
- Throws:
IOException- the io exception
-
getChangedFiles
Gets changed files.- Returns:
- the changed files
- Throws:
IOException- the io exception
-
getMergeCommitSha
See GitHub blog post- Returns:
- the merge commit sha
- Throws:
IOException- the io exception
-
getRequestedReviewers
Gets requested reviewers.- Returns:
- the requested reviewers
- Throws:
IOException- the io exception
-
getRequestedTeams
Gets requested teams.- Returns:
- the requested teams
- Throws:
IOException- the io exception
-
refresh
Repopulates this object.- Specified by:
refreshin interfaceRefreshable- Throws:
IOException- Signals that an I/O exception has occurred.
-
listFiles
Retrieves all the files associated to this pull request. The paginated response returns 30 files per page by default.- Returns:
- the paged iterable
- See Also:
-
listReviews
Retrieves all the reviews associated to this pull request.- Returns:
- the paged iterable
-
listReviewComments
Obtains all the review comments associated with this pull request.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listCommits
Retrieves all the commits associated to this pull request.- Returns:
- the paged iterable
-
createReview
@Deprecated public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event, GHPullRequestReviewComment... comments) throws IOException Deprecated.UsecreateReview()Create review gh pull request review.- Parameters:
body- the bodyevent- the eventcomments- the comments- Returns:
- the gh pull request review
- Throws:
IOException- the io exception
-
createReview
@Deprecated public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event, List<GHPullRequestReviewComment> comments) throws IOException Deprecated.UsecreateReview()Create review gh pull request review.- Parameters:
body- the bodyevent- the eventcomments- the comments- Returns:
- the gh pull request review
- Throws:
IOException- the io exception
-
createReview
Create review gh pull request review builder.- Returns:
- the gh pull request review builder
-
createReviewComment
Create gh pull request review comment builder.- Returns:
- the gh pull request review comment builder.
-
createReviewComment
@Deprecated public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position) throws IOException Deprecated.Create review comment gh pull request review comment.- Parameters:
body- the bodysha- the shapath- the pathposition- the position- Returns:
- the gh pull request review comment
- Throws:
IOException- the io exception
-
requestReviewers
Request reviewers.- Parameters:
reviewers- the reviewers- Throws:
IOException- the io exception
-
requestTeamReviewers
Request team reviewers.- Parameters:
teams- the teams- Throws:
IOException- the io exception
-
setBaseBranch
Set the base branch on the pull request.- Parameters:
newBaseBranch- the name of the new base branch- Returns:
- the updated pull request
- Throws:
IOException- the io exception
-
updateBranch
Updates the branch. The same as pressing the button in the web GUI.- Throws:
IOException- the io exception
-
merge
Merge this pull request.The equivalent of the big green "Merge pull request" button.
- Parameters:
msg- Commit message. If null, the default one will be used.- Throws:
IOException- the io exception
-
merge
Merge this pull request.The equivalent of the big green "Merge pull request" button.
- Parameters:
msg- Commit message. If null, the default one will be used.sha- SHA that pull request head must match to allow merge.- Throws:
IOException- the io exception
-
merge
Merge this pull request, using the specified merge method.The equivalent of the big green "Merge pull request" button.
- Parameters:
msg- Commit message. If null, the default one will be used.sha- the shamethod- SHA that pull request head must match to allow merge.- Throws:
IOException- the io exception
-
getRoot
Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.Get the rootGitHubinstance for this object.- Returns:
- the root
GitHubinstance
-
createReview()