@@ -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 ):
@@ -297,6 +299,8 @@ def push_to_remote(self, base_branch, head_branch, commit_message=""):
297
299
click .echo (cpe .output )
298
300
set_state (WORKFLOW_STATES .PUSHING_TO_REMOTE_FAILED )
299
301
else :
302
+ if not self .auto_pr :
303
+ return
300
304
gh_auth = os .getenv ("GH_AUTH" )
301
305
if gh_auth :
302
306
set_state (WORKFLOW_STATES .PR_CREATING )
@@ -577,6 +581,17 @@ class state:
577
581
default = True ,
578
582
help = "Changes won't be pushed to remote" ,
579
583
)
584
+ @click .option (
585
+ "--auto-pr/--no-auto-pr" ,
586
+ "auto_pr" ,
587
+ is_flag = True ,
588
+ default = True ,
589
+ help = (
590
+ "If auto PR is enabled, cherry-picker will automatically open a PR"
591
+ " through API if GH_AUTH env var is set, or automatically open the PR"
592
+ " creation page in the web browser otherwise."
593
+ ),
594
+ )
580
595
@click .option (
581
596
"--config-path" ,
582
597
"config_path" ,
@@ -592,7 +607,7 @@ class state:
592
607
@click .argument ("branches" , nargs = - 1 )
593
608
@click .pass_context
594
609
def cherry_pick_cli (
595
- ctx , dry_run , pr_remote , abort , status , push , config_path , commit_sha1 , branches
610
+ ctx , dry_run , pr_remote , abort , status , push , auto_pr , config_path , commit_sha1 , branches
596
611
):
597
612
"""cherry-pick COMMIT_SHA1 into target BRANCHES."""
598
613
@@ -607,6 +622,7 @@ def cherry_pick_cli(
607
622
branches ,
608
623
dry_run = dry_run ,
609
624
push = push ,
625
+ auto_pr = auto_pr ,
610
626
config = config ,
611
627
chosen_config_path = chosen_config_path ,
612
628
)
0 commit comments