Answer stability round 2: 0 🔴, 1 🟡 (0 misread); a test of the last poll, early returns in pushed, a plainer gh row match

This commit is contained in:
2026-11-27 16:02:59 +01:00
parent f46946f6de
commit 1703f0d47b
3 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ def pull_at(forge: Forge, branch: str, head: str | None, state: typing.Literal["
if isinstance(listed, Failure):
return listed
rows = [line.split("\t") for line in listed.splitlines()]
return next((row[0] for row in rows if row[1:] == ([head, "false"] if head is not None else row[1:2] + ["false"])), None)
return next((row[0] for row in rows if len(row) == 3 and row[2] == "false" and head in (None, row[1])), None)
# Gitea lists at most 50 a page; the pull request sought is among the newest. Gitea has no merged state: a merged pull request is a closed one marked merged.
pulls = gitea(run, f"repos/{{owner}}/{{repo}}/pulls?state={'open' if state == 'open' else 'closed'}&limit=50")
if isinstance(pulls, Failure):