2323 */
2424package org .kohsuke .github ;
2525
26+ import static org .kohsuke .github .Previews .POLARIS ;
27+
2628import java .io .IOException ;
2729import java .net .URL ;
2830import java .util .Collection ;
@@ -277,7 +279,7 @@ public GHPullRequestReviewComment createReviewComment(String body, String sha, S
277279 * Commit message. If null, the default one will be used.
278280 */
279281 public void merge (String msg ) throws IOException {
280- merge (msg ,null );
282+ merge (msg ,( String ) null );
281283 }
282284
283285 /**
@@ -294,6 +296,27 @@ public void merge(String msg, String sha) throws IOException {
294296 new Requester (root ).method ("PUT" ).with ("commit_message" ,msg ).with ("sha" ,sha ).to (getApiRoute ()+"/merge" );
295297 }
296298
299+ /**
300+ * Merge this pull request, using the specified merge method.
301+ *
302+ * The equivalent of the big green "Merge pull request" button.
303+ *
304+ * @param msg
305+ * Commit message. If null, the default one will be used.
306+ * @param method
307+ * SHA that pull request head must match to allow merge.
308+ */
309+ @ Preview @ Deprecated
310+ public void merge (String msg , MergeMethod method ) throws IOException {
311+ new Requester (root ).method ("PUT" )
312+ .withPreview (POLARIS )
313+ .with ("commit_message" ,msg )
314+ .with ("merge_method" ,method )
315+ .to (getApiRoute ()+"/merge" );
316+ }
317+
318+ public enum MergeMethod { MERGE , SQUASH , REBASE }
319+
297320 private void fetchIssue () throws IOException {
298321 if (!fetchedIssueDetails ) {
299322 new Requester (root ).to (getIssuesApiRoute (), this );
0 commit comments