@@ -98,6 +98,7 @@ def __init__(
9898 prefix_commit = True ,
9999 config = DEFAULT_CONFIG ,
100100 chosen_config_path = None ,
101+ auto_pr = True ,
101102 ):
102103
103104 self .chosen_config_path = chosen_config_path
@@ -125,6 +126,7 @@ def __init__(
125126 self .branches = branches
126127 self .dry_run = dry_run
127128 self .push = push
129+ self .auto_pr = auto_pr
128130 self .prefix_commit = prefix_commit
129131
130132 def set_paused_state (self ):
@@ -297,6 +299,8 @@ def push_to_remote(self, base_branch, head_branch, commit_message=""):
297299 click .echo (cpe .output )
298300 set_state (WORKFLOW_STATES .PUSHING_TO_REMOTE_FAILED )
299301 else :
302+ if not self .auto_pr :
303+ return
300304 gh_auth = os .getenv ("GH_AUTH" )
301305 if gh_auth :
302306 set_state (WORKFLOW_STATES .PR_CREATING )
@@ -577,6 +581,17 @@ class state:
577581 default = True ,
578582 help = "Changes won't be pushed to remote" ,
579583)
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+ )
580595@click .option (
581596 "--config-path" ,
582597 "config_path" ,
@@ -592,7 +607,7 @@ class state:
592607@click .argument ("branches" , nargs = - 1 )
593608@click .pass_context
594609def 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
596611):
597612 """cherry-pick COMMIT_SHA1 into target BRANCHES."""
598613
@@ -607,6 +622,7 @@ def cherry_pick_cli(
607622 branches ,
608623 dry_run = dry_run ,
609624 push = push ,
625+ auto_pr = auto_pr ,
610626 config = config ,
611627 chosen_config_path = chosen_config_path ,
612628 )
0 commit comments