@@ -943,6 +943,8 @@ def tag(dry_run: bool, no_edit: bool) -> None:
943943 )
944944
945945 if docs_files_staged :
946+ docs_branch = f"docs/changelog-v{ version } "
947+ run_command (["git" , "checkout" , "-b" , docs_branch ])
946948 for f in docs_files_staged :
947949 run_command (["git" , "add" , f ])
948950 run_command (
@@ -954,8 +956,69 @@ def tag(dry_run: bool, no_edit: bool) -> None:
954956 ]
955957 )
956958 console .print ("[green]✓[/green] Committed docs updates" )
957- run_command (["git" , "push" ])
958- console .print ("[green]✓[/green] Pushed docs updates" )
959+
960+ run_command (["git" , "push" , "-u" , "origin" , docs_branch ])
961+ console .print (f"[green]✓[/green] Pushed branch { docs_branch } " )
962+
963+ run_command (
964+ [
965+ "gh" ,
966+ "pr" ,
967+ "create" ,
968+ "--base" ,
969+ "main" ,
970+ "--title" ,
971+ f"docs: update changelog and version for v{ version } " ,
972+ "--body" ,
973+ "" ,
974+ ]
975+ )
976+ console .print ("[green]✓[/green] Created docs PR" )
977+
978+ run_command (
979+ [
980+ "gh" ,
981+ "pr" ,
982+ "merge" ,
983+ docs_branch ,
984+ "--squash" ,
985+ "--auto" ,
986+ "--delete-branch" ,
987+ ]
988+ )
989+ console .print ("[green]✓[/green] Enabled auto-merge on docs PR" )
990+
991+ import time
992+
993+ console .print ("[cyan]Waiting for PR checks to pass and merge...[/cyan]" )
994+ while True :
995+ time .sleep (10 )
996+ try :
997+ state = run_command (
998+ [
999+ "gh" ,
1000+ "pr" ,
1001+ "view" ,
1002+ docs_branch ,
1003+ "--json" ,
1004+ "state" ,
1005+ "--jq" ,
1006+ ".state" ,
1007+ ]
1008+ )
1009+ except subprocess .CalledProcessError :
1010+ state = ""
1011+
1012+ if state == "MERGED" :
1013+ break
1014+
1015+ console .print ("[dim]Still waiting for PR to merge...[/dim]" )
1016+
1017+ console .print ("[green]✓[/green] Docs PR merged" )
1018+
1019+ run_command (["git" , "checkout" , "main" ])
1020+ run_command (["git" , "pull" ])
1021+ console .print ("[green]✓[/green] main branch updated with docs changes" )
9591022 else :
9601023 for lang in changelog_langs :
9611024 cl_path = cwd / "docs" / lang / "changelog.mdx"
@@ -971,6 +1034,9 @@ def tag(dry_run: bool, no_edit: bool) -> None:
9711034 console .print (
9721035 "[dim][DRY RUN][/dim] Skipping docs version (pre-release)"
9731036 )
1037+ console .print (
1038+ f"[dim][DRY RUN][/dim] Would create branch docs/changelog-v{ version } , PR, and merge"
1039+ )
9741040
9751041 if not dry_run :
9761042 with console .status (f"[cyan]Creating tag { tag_name } ..." ):
0 commit comments