Skip to content

Commit f6a3e63

Browse files
committed
feat: improve error handling in update-demo script
1 parent ac14c48 commit f6a3e63

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/update-demo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def update_demo(
6969
f"{demo_name} is already up to date with {desired_branch_name} at {last_update_commit}",
7070
fg=typer.colors.YELLOW
7171
)
72+
raise typer.Abort()
7273

7374
if not is_ancestor(last_update_commit, template_commit):
7475
raise ValueError(
@@ -171,8 +172,10 @@ def _create_demo_pr(demo_path: Path, branch: str, commit_start: str) -> None:
171172

172173
def _get_pr_url(branch: str) -> str:
173174
"""Returns the url of the current branch's PR."""
174-
result: subprocess.CompletedProcess = gh("pr", "view", branch, "--json", "url", "--jq", ".url")
175-
if result.returncode != 0:
175+
result: Optional[subprocess.CompletedProcess] = gh(
176+
"pr", "view", branch, "--json", "url", "--jq", ".url", ignore_error=True
177+
)
178+
if result is None:
176179
raise ValueError(f"Failed to find a PR URL for branch {branch}.")
177180
return result.stdout.strip()
178181

0 commit comments

Comments
 (0)