@@ -98,6 +98,7 @@ def __init__(
98
98
prefix_commit = True ,
99
99
config = DEFAULT_CONFIG ,
100
100
chosen_config_path = None ,
101
+ auto_pr = True ,
101
102
):
102
103
103
104
self .chosen_config_path = chosen_config_path
@@ -125,6 +126,7 @@ def __init__(
125
126
self .branches = branches
126
127
self .dry_run = dry_run
127
128
self .push = push
129
+ self .auto_pr = auto_pr
128
130
self .prefix_commit = prefix_commit
129
131
130
132
def set_paused_state (self ):
@@ -300,6 +302,8 @@ def push_to_remote(self, base_branch, head_branch, commit_message=""):
300
302
click .echo (cpe .output )
301
303
set_state (WORKFLOW_STATES .PUSHING_TO_REMOTE_FAILED )
302
304
else :
305
+ if not self .auto_pr :
306
+ return
303
307
gh_auth = os .getenv ("GH_AUTH" )
304
308
if gh_auth :
305
309
set_state (WORKFLOW_STATES .PR_CREATING )
@@ -572,6 +576,17 @@ class state:
572
576
default = True ,
573
577
help = "Changes won't be pushed to remote" ,
574
578
)
579
+ @click .option (
580
+ "--auto-pr/--no-auto-pr" ,
581
+ "auto_pr" ,
582
+ is_flag = True ,
583
+ default = True ,
584
+ help = (
585
+ "If auto PR is enabled, cherry-picker will automatically open a PR"
586
+ " through API if GH_AUTH env var is set, or automatically open the PR"
587
+ " creation page in the web browser otherwise."
588
+ ),
589
+ )
575
590
@click .option (
576
591
"--config-path" ,
577
592
"config_path" ,
@@ -587,7 +602,7 @@ class state:
587
602
@click .argument ("branches" , nargs = - 1 )
588
603
@click .pass_context
589
604
def cherry_pick_cli (
590
- ctx , dry_run , pr_remote , abort , status , push , config_path , commit_sha1 , branches
605
+ ctx , dry_run , pr_remote , abort , status , push , auto_pr , config_path , commit_sha1 , branches
591
606
):
592
607
"""cherry-pick COMMIT_SHA1 into target BRANCHES."""
593
608
@@ -602,6 +617,7 @@ def cherry_pick_cli(
602
617
branches ,
603
618
dry_run = dry_run ,
604
619
push = push ,
620
+ auto_pr = auto_pr ,
605
621
config = config ,
606
622
chosen_config_path = chosen_config_path ,
607
623
)
0 commit comments