Skip to content

Commit 0198495

Browse files
committed
feat: add small check to gracefully exit when trying to create an existing PR
1 parent 6097e9c commit 0198495

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/update-demo.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# ]
99
# ///
1010
import itertools
11+
import subprocess
1112
from pathlib import Path
1213
from subprocess import CompletedProcess
1314
from typing import Annotated
@@ -144,6 +145,10 @@ def _validate_template_main_not_checked_out(branch: str) -> None:
144145
def _create_demo_pr(demo_path: Path, branch: str, commit_start: str) -> None:
145146
"""Creates a PR to merge the given branch into develop."""
146147
gh("repo", "set-default", f"{DEMO.app_author}/{DEMO.app_name}")
148+
search_results: subprocess.CompletedProcess = gh("pr", "list", "--state", "open", "--search", branch)
149+
if "no pull requests match your search" not in search_results.stdout:
150+
typer.secho(f"Skipping PR creation due to existing PR found for branch {branch}")
151+
return
147152

148153
body: str = _get_demo_feature_pr_body(demo_path=demo_path, commit_start=commit_start)
149154

0 commit comments

Comments
 (0)