Find an epic repo's checkout and project config by its name, and clone a missing one from the place of the epic's other repos
CI / tests (pull_request) Failing after 4m35s

This commit is contained in:
2026-11-18 12:59:17 +01:00
parent f444dca67a
commit 3de693f1a5
9 changed files with 331 additions and 4 deletions
+9
View File
@@ -1,5 +1,6 @@
"""Which forge a checkout's origin is on, and running that forge's CLI in the checkout."""
import json
import re
import subprocess
import typing
@@ -16,6 +17,14 @@ def forge_of(origin_url: str) -> Forge:
return "gh" if "github.com" in origin_url else "tea"
def url_beside(origin_url: str, name: str) -> str | None:
"""The origin URL of the repo called name in the same place, host and owner, as origin_url's repo; None where origin_url has no place, such as a bare name. A trailing `.git` is dropped, since gh and tea clone without it."""
trimmed = origin_url.rstrip("/").removesuffix(".git")
place = re.fullmatch(r"(.+[/:])[^/:]+", trimmed)
# A scheme's own `//` or `:` leaves no repo to put a name beside.
return place.group(1) + name if place and not place.group(1).endswith("//") and not re.fullmatch(r"\w+:", place.group(1)) else None
def runner(cwd: str) -> Run:
def run(command: list[str]) -> str | Failure:
try: