Move the forge helpers into bin/forge/, which chunk_preflight, chunk_pr, deploy_release and larv_review import
CI / tests (pull_request) Successful in 3m9s

This commit is contained in:
2026-11-16 23:42:01 +01:00
parent 4b5086153a
commit 73600d7288
18 changed files with 179 additions and 145 deletions
+10 -9
View File
@@ -14,9 +14,10 @@ from deploy_release.deploy import deploy
from failure import Failure
from plan_store.todo_md import FilePlan
from record_store.stores import FileStore
from deploy_release import forge
from chunk_preflight.choices import forge_of
from forge.commands import forge_of, runner
from plan.release import newest_tag, Release, UNRELEASED_HEADING, version
from forge import pulls
from deploy_release import release_pull
from project_config import templates
@@ -153,7 +154,7 @@ def land(clone: str, ref: str, named: str, title: str) -> Failure | None:
url = git("config", "--get", "remote.origin.url", cwd=clone)
if isinstance(url, Failure):
return url
on, run, branch, base = forge_of(url), forge.runner(clone), f"release-{named}", ref.removeprefix("origin/")
on, run, branch, base = forge_of(url), runner(clone), f"release-{named}", ref.removeprefix("origin/")
head = branch_head(branch, clone)
if isinstance(head, Failure):
return head
@@ -168,23 +169,23 @@ def land(clone: str, ref: str, named: str, title: str) -> Failure | None:
head = branch_head(branch, clone) or Failure(f"pushed {branch}, but origin holds no such branch")
if isinstance(head, Failure):
return head
number = forge.open_pull(on, branch, head, run)
number = pulls.open_pull(on, branch, head, run)
if number is None:
if isinstance(created := forge.create_pull(on, branch, base, title, run), Failure):
if isinstance(created := release_pull.create_pull(on, branch, base, title, run), Failure):
return created
number = forge.open_pull(on, branch, head, run) or Failure(f"opened a pull request for {branch}, but the forge lists none from origin at {head[:12]}")
number = pulls.open_pull(on, branch, head, run) or Failure(f"opened a pull request for {branch}, but the forge lists none from origin at {head[:12]}")
if isinstance(number, str):
said(f"opened pull request {number}")
if isinstance(number, Failure):
return number
required = forge.required_checks(on, base, run)
required = pulls.required_checks(on, base, run)
if isinstance(required, Failure):
return required
said(f"waiting for the checks of pull request {number}" + (f"; {base} requires {', '.join(sorted(required))}" if required else ""))
if isinstance(passed := forge.checks_passed(on, number, head, required, run), Failure):
if isinstance(passed := pulls.checks_passed(on, number, head, required, run), Failure):
return passed
said(f"the checks of pull request {number} passed")
if isinstance(merged := forge.merge(on, number, head, run), Failure):
if isinstance(merged := release_pull.merge(on, number, head, run), Failure):
return merged
said(f"merged pull request {number}")
return None