Add the project setting merge = "human", under which chunk-pr merge leaves the pull request ready and a do-epic chunk parks on your merge

This commit is contained in:
Lilleman
2026-11-19 15:51:44 +01:00
parent 017cf33611
commit e2f5661760
15 changed files with 240 additions and 58 deletions
+10 -2
View File
@@ -12,8 +12,10 @@ WAIT_SECONDS = 90 * 60
PARKS = "CHUNK_PR_PARKS"
def awaited(forge: Forge, wait_for_approval: bool) -> bool | Failure:
"""Whether merge waits for an approval: the project config's `wait-for-approval`. chunk-pr reads approvals on GitHub only, so a Gitea project that sets it fails, and merge never skips an approval the config requires."""
def awaited(forge: Forge, wait_for_approval: bool, by_human: bool = False) -> bool | Failure:
"""Whether merge waits for an approval: the project config's `wait-for-approval`, and never where a person merges the pull request (by_human), who sees its approval themselves. chunk-pr reads approvals on GitHub only, so a Gitea project that sets it fails, and merge never skips an approval the config requires."""
if by_human:
return False
if wait_for_approval and forge != "gh":
return Failure("the project's config sets wait-for-approval, but chunk-pr reads approvals on GitHub only, so it cannot merge this pull request; ask the human to merge it")
return wait_for_approval
@@ -52,6 +54,12 @@ def left_to_park(number: str, run: Run) -> Failure:
return unanswered(number, run) or Failure(f"pull request {number} passed its checks and awaits an approval; end your run now, since do-epic parks the chunk and resumes this session once it is approved or a reviewer comments")
def left_to_a_person(number: str, parks: bool) -> str:
"""What merge prints where the project's config leaves the merge of pull request number to a person (`merge = "human"`): what the worker does now, which under PARKS is to end its run, as in `left_to_park`."""
now = "end your run now, since do-epic parks the chunk and resumes this session once it is merged or a reviewer comments." if parks else "leave the merge to them, and report the chunk as ready to merge. Once it is merged, run chunk-pr clean in this worktree."
return f"Marked pull request #{number} ready. It passed its checks and awaits a person's merge, since the project's config sets `merge = \"human\"`: {now}"
def unanswered(number: str, run: Run) -> Failure | None:
"""A Failure naming the files where a reviewer's comment waits for an answer on pull request number, as `waiting_threads` finds them, or saying why they cannot be read. None where no thread waits."""
waiting = waiting_threads(number, run)