Rebase the queue with real git, and wait for mergeable before arming #1064
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1064
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ci/auto-rebase-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The first version of the auto-rebase job could not have worked. All three faults only show up when you execute it — which is what happened last iteration.
1. The API's "rebase" is not a rebase.
POST /pulls/{n}/updatewith{"style":"rebase"}records aMerge branch 'main' into <branch>commit in this Forgejo version. Repeating it every ten minutes leaves branches that can no longer be updated: #65 answered HTTP 500 on every attempt, and #110, #152, #198 all ended up with merge commits instead of rebased histories. This job now fetches the branch, rebases locally and force-pushes--force-with-lease.2. Arming immediately after the rebase always fails.
mergeableis computed asynchronously; arming in the same breath returns 405 "Please try again later", which reads as a refusal but only means "not computed". Measured settling time on this host: 5 s to >140 s. The job now polls (settle_seconds, default 120) before arming.3. Empty diffs. #152 and #198 are duplicates — their device file is already on
main, so after rebasing they have no diff. Pushing them produces a blocked merge forever. They are now detected (git diff --quiet origin/main HEAD) and reported instead.Also fixes the loop counters:
echo "$pulls" | whileran the loop in a subshell, so the summary line always printed zeros.Verified locally
run:block passesbash -n.Still open (needs a human, not code)
The
schedule:trigger has never fired on this instance, andPOST /actions/workflows/<file>/dispatchesreturns 204 while producing no run — forci.ymltoo. So this workflow is correct but currently only runs when driven by hand. That is a Forgejo scheduler issue, not a workflow issue.The first version of this job could not have worked, for three reasons that only show up once you run it. 1. It called POST /pulls/{n}/update with {"style":"rebase"}. In this Forgejo version that does not rebase: it records a 'Merge branch main into <branch>' commit instead. Repeated every ten minutes it leaves branches that can no longer be updated at all - #65 answered HTTP 500 on every attempt. The job now fetches the branch, rebases it locally, and force-pushes with a lease, which leaves the branch exactly as the author wrote it. 2. It armed the merge in the same breath as the rebase. Forgejo computes 'mergeable' asynchronously, so that call returns 405 'Please try again later' on essentially every PR - a refusal that means 'not computed yet'. The job now polls until it settles, then arms. 3. It had no idea what to do with a PR whose change is already on main. #152 and #198 are both empty diffs after rebasing; pushing them produces a blocked merge and a permanently red row. They are now detected and reported instead. Also fixes the loop counters: 'echo | while' ran the loop in a subshell, so the summary line always said zero regardless of what happened.