Class GHPullRequest

    • Constructor Detail

      • GHPullRequest

        public GHPullRequest()
    • Method Detail

      • getApiRoute

        protected String getApiRoute()
        Description copied from class: GHIssue
        Gets api route.
        Overrides:
        getApiRoute in class GHIssue
        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 class GHIssue
        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 class GHIssue
        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
      • 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
      • 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 body
        sha - the sha
        path - the path
        position - 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
      • 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 sha
        method - SHA that pull request head must match to allow merge.
        Throws:
        IOException - the io exception