fj pr merge --auto: schedule a merge once required checks pass #178

Merged
stephen merged 2 commits from feat/164-pr-merge-auto into main 2026-06-15 16:26:33 +00:00
Owner

Closes #164.

Spike first: confirmed the rasterhub Forgejo build (15.0.2 / gitea-1.22) exposes scheduled auto-merge via merge_when_checks_succeed on POST .../pulls/{n}/merge and a DELETE .../merge to cancel. Built on that.

  • fj pr merge N --auto schedules a server-side merge that completes once all required checks pass; an already-green PR merges immediately. Honors --style / --title / --message / --delete-branch.
  • fj pr merge N --disable-auto cancels a pending schedule; a clean message when nothing is scheduled instead of a bare 404.
  • pr view / pr checks show Auto-merge: scheduled while one is pending. Forgejo records the schedule on the issue timeline only (not the PR object) and the comment carries no style, so the line is best-effort and omits the style; the lookup degrades silently on error.
  • A host build without scheduled-merge support ignores the flag and rejects a not-yet-green PR with the same opaque error a normal merge would; in that case we reuse the #162 diagnosis and note that --auto did not schedule.

Tests: unit coverage for the timeline pending-state logic and merge-body serialization; wiremock coverage for scheduling, cancel, the cancel-404 path, and timeline detection. Docs and CHANGELOG updated.

Closes #164. Spike first: confirmed the rasterhub Forgejo build (15.0.2 / gitea-1.22) exposes scheduled auto-merge via `merge_when_checks_succeed` on `POST .../pulls/{n}/merge` and a `DELETE .../merge` to cancel. Built on that. - `fj pr merge N --auto` schedules a server-side merge that completes once all required checks pass; an already-green PR merges immediately. Honors `--style` / `--title` / `--message` / `--delete-branch`. - `fj pr merge N --disable-auto` cancels a pending schedule; a clean message when nothing is scheduled instead of a bare 404. - `pr view` / `pr checks` show `Auto-merge: scheduled` while one is pending. Forgejo records the schedule on the issue timeline only (not the PR object) and the comment carries no style, so the line is best-effort and omits the style; the lookup degrades silently on error. - A host build without scheduled-merge support ignores the flag and rejects a not-yet-green PR with the same opaque error a normal merge would; in that case we reuse the #162 diagnosis and note that `--auto` did not schedule. Tests: unit coverage for the timeline pending-state logic and merge-body serialization; wiremock coverage for scheduling, cancel, the cancel-404 path, and timeline detection. Docs and CHANGELOG updated.
fj pr merge --auto: schedule auto-merge when checks pass (#164)
Some checks failed
ci / check (pull_request) Failing after 27s
ci / coverage (pull_request) Has been skipped
ci / live-e2e (pull_request) Has been skipped
4acaf5a488
Fix fmt and add auto field to existing merge test initializer
All checks were successful
ci / check (pull_request) Successful in 9m58s
ci / coverage (pull_request) Successful in 1m59s
ci / live-e2e (pull_request) Successful in 1m50s
4d57b1fdf6
stephen force-pushed feat/164-pr-merge-auto from 4d57b1fdf6
All checks were successful
ci / check (pull_request) Successful in 9m58s
ci / coverage (pull_request) Successful in 1m59s
ci / live-e2e (pull_request) Successful in 1m50s
to 22b252d9a8
All checks were successful
ci / check (pull_request) Successful in 9m58s
ci / coverage (pull_request) Successful in 1m48s
ci / live-e2e (pull_request) Successful in 1m51s
2026-06-15 16:09:24 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj!178
No description provided.