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
public class GHPullRequest extends GHIssue implements Refreshable
A pull request.- Author:
- Kohsuke Kawaguchi
- See Also:
GHRepository#getPullRequest(int)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GHPullRequest.MergeMethod
The enum MergeMethod.-
Nested classes/interfaces inherited from class org.kohsuke.github.GHIssue
GHIssue.PullRequest
-
-
Constructor Summary
Constructors Constructor Description GHPullRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canMaintainerModify()
Can maintainer modify boolean.GHPullRequestReviewBuilder
createReview()
Create review gh pull request review builder.GHPullRequestReview
createReview(String body, GHPullRequestReviewState event, List<GHPullRequestReviewComment> comments)
Deprecated.UsecreateReview()
GHPullRequestReview
createReview(String body, GHPullRequestReviewState event, GHPullRequestReviewComment... comments)
Deprecated.UsecreateReview()
GHPullRequestReviewComment
createReviewComment(String body, String sha, String path, int position)
Create review comment gh pull request review comment.int
getAdditions()
Gets additions.protected String
getApiRoute()
Gets api route.GHCommitPointer
getBase()
This points to where the change should be pulled into, but I'm not really sure what exactly it means.int
getChangedFiles()
Gets changed files.GHUser
getClosedBy()
Reports who has closed the issue.int
getCommits()
Gets commits.int
getDeletions()
Gets deletions.URL
getDiffUrl()
The diff file, like https://github.com/jenkinsci/jenkins/pull/100.diffGHCommitPointer
getHead()
The change that should be pulled.Date
getIssueUpdatedAt()
Deprecated.URL
getIssueUrl()
The URL of the patch file.Boolean
getMergeable()
Is this PR mergeable?String
getMergeableState()
Gets mergeable state.String
getMergeCommitSha()
See GitHub blog postDate
getMergedAt()
Gets merged at.GHUser
getMergedBy()
Gets merged by.URL
getPatchUrl()
The URL of the patch file.GHIssue.PullRequest
getPullRequest()
Returns non-null if this issue is a shadow of a pull request.List<GHUser>
getRequestedReviewers()
Gets requested reviewers.List<GHTeam>
getRequestedTeams()
Gets requested teams.int
getReviewComments()
Gets review comments.boolean
isDraft()
Is draft boolean.boolean
isMerged()
Is merged boolean.PagedIterable<GHPullRequestCommitDetail>
listCommits()
Retrieves all the commits associated to this pull request.PagedIterable<GHPullRequestFileDetail>
listFiles()
Retrieves all the files associated to this pull request.PagedIterable<GHPullRequestReviewComment>
listReviewComments()
Obtains all the review comments associated with this pull request.PagedIterable<GHPullRequestReview>
listReviews()
Retrieves all the reviews associated to this pull request.void
merge(String msg)
Merge this pull request.void
merge(String msg, String sha)
Merge this pull request.void
merge(String msg, String sha, GHPullRequest.MergeMethod method)
Merge this pull request, using the specified merge method.void
refresh()
Repopulates this object.void
requestReviewers(List<GHUser> reviewers)
Request reviewers.void
requestTeamReviewers(List<GHTeam> teams)
Request team reviewers.GHPullRequest
setBaseBranch(String newBaseBranch)
Set the base branch on the pull requestvoid
updateBranch()
Deprecated.-
Methods inherited from class org.kohsuke.github.GHIssue
addAssignees, addAssignees, addLabels, addLabels, addLabels, assignTo, close, comment, createReaction, getApiURL, getAssignee, getAssignees, getBody, getClosedAt, getComments, getCommentsCount, getHtmlUrl, getIssuesApiRoute, getLabels, getLogins, getMilestone, getNumber, getRepository, getState, getTitle, getUser, isLocked, isPullRequest, listComments, listEvents, listReactions, lock, removeAssignees, removeAssignees, removeLabel, removeLabels, removeLabels, removeLabels, reopen, setAssignees, setAssignees, setBody, setLabels, setMilestone, setTitle, unlock
-
Methods inherited from class org.kohsuke.github.GHObject
getCreatedAt, getId, getNodeId, getResponseHeaderFields, getUpdatedAt, getUrl, setResponseHeaderFields, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.kohsuke.github.Refreshable
refresh
-
-
-
-
Method Detail
-
getApiRoute
protected String getApiRoute()
Description copied from class:GHIssue
Gets api route.- Overrides:
getApiRoute
in classGHIssue
- Returns:
- the api route
-
getPatchUrl
public URL getPatchUrl()
The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch- Returns:
- the patch url
-
getIssueUrl
public URL getIssueUrl()
The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch- Returns:
- the issue url
-
getBase
public GHCommitPointer 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
public GHCommitPointer getHead()
The change that should be pulled. The tip of the commits to merge.- Returns:
- the head
-
getIssueUpdatedAt
@Deprecated public Date getIssueUpdatedAt() throws IOException
Deprecated.Gets issue updated at.- Returns:
- the issue updated at
- Throws:
IOException
- the io exception
-
getDiffUrl
public URL getDiffUrl()
The diff file, like https://github.com/jenkinsci/jenkins/pull/100.diff- Returns:
- the diff url
-
getMergedAt
public Date getMergedAt()
Gets merged at.- Returns:
- the merged at
-
getClosedBy
public GHUser getClosedBy()
Description copied from class:GHIssue
Reports who has closed the issue.Note that GitHub doesn't always seem to report this information even for an issue that's already closed. See https://github.com/kohsuke/github-api/issues/60.
- Overrides:
getClosedBy
in classGHIssue
- Returns:
- the closed by
-
getPullRequest
public GHIssue.PullRequest getPullRequest()
Description copied from class:GHIssue
Returns non-null if this issue is a shadow of a pull request.- Overrides:
getPullRequest
in classGHIssue
- Returns:
- the pull request
-
getMergedBy
public GHUser getMergedBy() throws IOException
Gets merged by.- Returns:
- the merged by
- Throws:
IOException
- the io exception
-
getReviewComments
public int getReviewComments() throws IOException
Gets review comments.- Returns:
- the review comments
- Throws:
IOException
- the io exception
-
getAdditions
public int getAdditions() throws IOException
Gets additions.- Returns:
- the additions
- Throws:
IOException
- the io exception
-
getCommits
public int getCommits() throws IOException
Gets commits.- Returns:
- the commits
- Throws:
IOException
- the io exception
-
isMerged
public boolean isMerged() throws IOException
Is merged boolean.- Returns:
- the boolean
- Throws:
IOException
- the io exception
-
canMaintainerModify
public boolean canMaintainerModify() throws IOException
Can maintainer modify boolean.- Returns:
- the boolean
- Throws:
IOException
- the io exception
-
isDraft
public boolean isDraft() throws IOException
Is draft boolean.- Returns:
- the boolean
- Throws:
IOException
- the io exception
-
getMergeable
public Boolean getMergeable() throws IOException
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
public int getDeletions() throws IOException
Gets deletions.- Returns:
- the deletions
- Throws:
IOException
- the io exception
-
getMergeableState
public String getMergeableState() throws IOException
Gets mergeable state.- Returns:
- the mergeable state
- Throws:
IOException
- the io exception
-
getChangedFiles
public int getChangedFiles() throws IOException
Gets changed files.- Returns:
- the changed files
- Throws:
IOException
- the io exception
-
getMergeCommitSha
public String getMergeCommitSha() throws IOException
See GitHub blog post- Returns:
- the merge commit sha
- Throws:
IOException
- the io exception
-
getRequestedReviewers
public List<GHUser> getRequestedReviewers() throws IOException
Gets requested reviewers.- Returns:
- the requested reviewers
- Throws:
IOException
- the io exception
-
getRequestedTeams
public List<GHTeam> getRequestedTeams() throws IOException
Gets requested teams.- Returns:
- the requested teams
- Throws:
IOException
- the io exception
-
refresh
public void refresh() throws IOException
Repopulates this object.- Specified by:
refresh
in interfaceRefreshable
- Throws:
IOException
- the io exception
-
listFiles
public PagedIterable<GHPullRequestFileDetail> listFiles()
Retrieves all the files associated to this pull request.- Returns:
- the paged iterable
-
listReviews
public PagedIterable<GHPullRequestReview> listReviews()
Retrieves all the reviews associated to this pull request.- Returns:
- the paged iterable
-
listReviewComments
public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOException
Obtains all the review comments associated with this pull request.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listCommits
public PagedIterable<GHPullRequestCommitDetail> 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
public GHPullRequestReviewBuilder createReview()
Create review gh pull request review builder.- Returns:
- the gh pull request review builder
-
createReviewComment
public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position) throws IOException
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
public void requestReviewers(List<GHUser> reviewers) throws IOException
Request reviewers.- Parameters:
reviewers
- the reviewers- Throws:
IOException
- the io exception
-
requestTeamReviewers
public void requestTeamReviewers(List<GHTeam> teams) throws IOException
Request team reviewers.- Parameters:
teams
- the teams- Throws:
IOException
- the io exception
-
setBaseBranch
public GHPullRequest setBaseBranch(String newBaseBranch) throws IOException
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
@Preview(LYDIAN) @Deprecated public void updateBranch() throws IOException
Deprecated.Updates the branch. The same as pressing the button in the web GUI.- Throws:
IOException
- the io exception
-
merge
public void merge(String msg) throws IOException
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
public void merge(String msg, String sha) throws IOException
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
public void merge(String msg, String sha, GHPullRequest.MergeMethod method) throws IOException
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
-
-