@@ -68,8 +68,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
6868 private String mergeable_state ;
6969 private int changed_files ;
7070 private String merge_commit_sha ;
71+ private AutoMerge auto_merge ;
7172
7273 // pull request reviewers
74+
7375 private GHUser [] requested_reviewers ;
7476 private GHTeam [] requested_teams ;
7577
@@ -84,11 +86,19 @@ protected String getApiRoute() {
8486 // Issues returned from search to do not have an owner. Attempt to use url.
8587 final URL url = Objects .requireNonNull (getUrl (), "Missing instance URL!" );
8688 return StringUtils .prependIfMissing (url .toString ().replace (root ().getApiUrl (), "" ), "/" );
87-
8889 }
8990 return "/repos/" + owner .getOwnerName () + "/" + owner .getName () + "/pulls/" + number ;
9091 }
9192
93+ /**
94+ * The status of auto merging a pull request.
95+ *
96+ * @return the {@linkplain AutoMerge} or {@code null} if no auto merge is set.
97+ */
98+ public AutoMerge getAutoMerge () {
99+ return auto_merge ;
100+ }
101+
92102 /**
93103 * The URL of the patch file. like https://github.com/jenkinsci/jenkins/pull/100.patch
94104 *
@@ -268,9 +278,7 @@ public Boolean getMergeable() throws IOException {
268278 return mergeable ;
269279 }
270280
271- /**
272- * for test purposes only
273- */
281+ /** for test purposes only */
274282 @ Deprecated
275283 Boolean getMergeableNoRefresh () throws IOException {
276284 return mergeable ;
@@ -351,6 +359,7 @@ public List<GHTeam> getRequestedTeams() throws IOException {
351359 /**
352360 * Fully populate the data by retrieving missing data.
353361 *
362+ * <p>
354363 * Depending on the original API call where this object is created, it may not contain everything.
355364 */
356365 private void populate () throws IOException {
@@ -359,9 +368,7 @@ private void populate() throws IOException {
359368 refresh ();
360369 }
361370
362- /**
363- * Repopulates this object.
364- */
371+ /** Repopulates this object. */
365372 public void refresh () throws IOException {
366373 if (isOffline ()) {
367374 return ; // cannot populate, will have to live with what we have
@@ -378,7 +385,6 @@ public void refresh() throws IOException {
378385 * default.
379386 *
380387 * @return the paged iterable
381- *
382388 * @see <a href="https://docs.github.com/en/rest/reference/pulls#list-pull-requests-files">List pull requests
383389 * files</a>
384390 */
@@ -577,6 +583,7 @@ public void updateBranch() throws IOException {
577583
578584 /**
579585 * Merge this pull request.
586+ *
580587 * <p>
581588 * The equivalent of the big green "Merge pull request" button.
582589 *
@@ -591,6 +598,7 @@ public void merge(String msg) throws IOException {
591598
592599 /**
593600 * Merge this pull request.
601+ *
594602 * <p>
595603 * The equivalent of the big green "Merge pull request" button.
596604 *
@@ -607,6 +615,7 @@ public void merge(String msg, String sha) throws IOException {
607615
608616 /**
609617 * Merge this pull request, using the specified merge method.
618+ *
610619 * <p>
611620 * The equivalent of the big green "Merge pull request" button.
612621 *
@@ -629,11 +638,58 @@ public void merge(String msg, String sha, MergeMethod method) throws IOException
629638 .send ();
630639 }
631640
632- /**
633- * The enum MergeMethod.
634- */
641+ /** The enum MergeMethod. */
635642 public enum MergeMethod {
636643 MERGE , SQUASH , REBASE
637644 }
638645
646+ /**
647+ * The status of auto merging a {@linkplain GHPullRequest}.
648+ *
649+ */
650+ @ SuppressFBWarnings (value = "UWF_UNWRITTEN_FIELD" , justification = "Field comes from JSON deserialization" )
651+ public static class AutoMerge {
652+
653+ private GHUser enabled_by ;
654+ private MergeMethod merge_method ;
655+ private String commit_title ;
656+ private String commit_message ;
657+
658+ /**
659+ * The user who enabled the auto merge of the pull request.
660+ *
661+ * @return the {@linkplain GHUser}
662+ */
663+ @ SuppressFBWarnings (value = { "EI_EXPOSE_REP" }, justification = "Expected behavior" )
664+ public GHUser getEnabledBy () {
665+ return enabled_by ;
666+ }
667+
668+ /**
669+ * The merge method of the auto merge.
670+ *
671+ * @return the {@linkplain MergeMethod}
672+ */
673+ public MergeMethod getMergeMethod () {
674+ return merge_method ;
675+ }
676+
677+ /**
678+ * the title of the commit, if e.g. {@linkplain MergeMethod#SQUASH} is used for the auto merge.
679+ *
680+ * @return the title of the commit
681+ */
682+ public String getCommitTitle () {
683+ return commit_title ;
684+ }
685+
686+ /**
687+ * the message of the commit, if e.g. {@linkplain MergeMethod#SQUASH} is used for the auto merge.
688+ *
689+ * @return the message of the commit
690+ */
691+ public String getCommitMessage () {
692+ return commit_message ;
693+ }
694+ }
639695}
0 commit comments