Answer security round 1: 0 🔴, 1 🟡 (0 misread); take only origin's own pull request at the branch's head and merge it pinned to that head
This commit is contained in:
+14
-18
@@ -7,14 +7,14 @@ import re
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from chunk_preflight.choices import forge_of
|
||||
from deploy_release import forge
|
||||
from release_standing import chunk_item, Cut, default_plan, Next, ReadyToCut, ReviewDue, Unplanned
|
||||
from git_repo import default_ref, git
|
||||
from deploy_release.deploy import deploy
|
||||
from failure import Failure
|
||||
from git_repo import default_ref, git
|
||||
from release import newest_tag, Release, version
|
||||
from release_standing import chunk_item, Cut, default_plan, Next, ReadyToCut, ReviewDue, Unplanned
|
||||
from deploy_release import forge
|
||||
from chunk_preflight.choices import forge_of
|
||||
from todo_table import items
|
||||
from release import newest_tag, Release, version
|
||||
|
||||
|
||||
def cut(clone: str, checkout: str) -> str | Failure:
|
||||
@@ -92,27 +92,23 @@ def land(clone: str, ref: str, named: str, title: str) -> Failure | None:
|
||||
if isinstance(url, Failure):
|
||||
return url
|
||||
on, run, branch, base = forge_of(url), forge.runner(clone), f"release-{named}", ref.removeprefix("origin/")
|
||||
number = forge.open_pull(on, branch, run)
|
||||
if isinstance(number, Failure):
|
||||
return number
|
||||
head = branch_head(branch, clone)
|
||||
if head is None:
|
||||
if isinstance(pushed := push_cut_commit(clone, ref, branch, named, title), Failure):
|
||||
return pushed
|
||||
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)
|
||||
if number is None:
|
||||
if head is None:
|
||||
if isinstance(pushed := push_cut_commit(clone, ref, branch, named, title), Failure):
|
||||
return pushed
|
||||
if isinstance(created := forge.create_pull(on, branch, base, title, run), Failure):
|
||||
return created
|
||||
number = forge.open_pull(on, branch, run)
|
||||
if number is None or isinstance(number, Failure):
|
||||
return number or Failure(f"opened a pull request for {branch}, but the forge lists none")
|
||||
head = branch_head(branch, clone)
|
||||
if head is None or isinstance(head, Failure):
|
||||
return head or Failure(f"origin holds no branch {branch}")
|
||||
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]}")
|
||||
if isinstance(number, Failure):
|
||||
return number
|
||||
if isinstance(passed := forge.checks_passed(on, number, head, run), Failure):
|
||||
return passed
|
||||
return forge.merge(on, number, run)
|
||||
return forge.merge(on, number, head, run)
|
||||
|
||||
|
||||
def branch_head(branch: str, clone: str) -> str | None | Failure:
|
||||
|
||||
Reference in New Issue
Block a user