Skip to content

fix: request auto-merge without --delete-branch under a merge queue - #6

Merged
chio-labs-delivery[bot] merged 1 commit into
mainfrom
fix/auto-merge-queue-delete-branch
Nov 11, 2026
Merged

chio-labs-delivery[bot] merged 1 commit into
mainfrom
fix/auto-merge-queue-delete-branch

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

gh refuses --delete-branch when the base branch has a merge queue ("Cannot use -d or --delete-branch when merge queue enabled"), so Request Auto-Merge failed on sqlbuild#1421, the first new pull request since sqlbuild's queue went on.

The step now asks GitHub whether the base branch has a merge queue and passes --delete-branch only when it doesn't. Repositories with a queue (sqlbuild, sqlquack) have delete-on-merge on, so their branches are still removed. Repositories without one keep today's behaviour, which matters because several (sqlclean, sqlload, sqlquack-evidence) don't have delete-on-merge on.

Checked: actionlint, and the GraphQL query run against sqlbuild and sqlquack (queue, no flag) and sqlclean (no queue, flag kept). The live test is the next new sqlbuild pull request.

gh refuses --delete-branch when the base branch has a merge queue, so
the workflow failed on every new sqlbuild pull request. Ask for branch
deletion only when there is no queue; with one, the repository's
delete-on-merge setting removes the branch.
@chio-labs-delivery
chio-labs-delivery Bot enabled auto-merge (squash) November 11, 2026 23:21
@chio-labs-delivery
chio-labs-delivery Bot merged commit b303789 into main Nov 11, 2026
4 checks passed
@chio-labs-delivery
chio-labs-delivery Bot deleted the fix/auto-merge-queue-delete-branch branch November 11, 2026 23:22

kvlonge commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up check on sqlstack-io/sqlbuild#1566: the workflow did not request auto-merge on ready_for_review.

  • 05:14:03 UTC: the draft PR was marked ready (head 67b5debd4). Within 2 seconds the same event started the repository's own Verify workflow (run 44242801071).
  • No Request Auto-Merge run followed. The only run for this head is 44238542362, the pull_request event from the push while the PR was still a draft, which was skipped as intended.
  • At 05:17:27 UTC, auto-merge was enabled by hand with gh pr merge 1566 --auto --squash --match-head-commit 67b5debd4….

The on.pull_request.types list includes ready_for_review, so the job's condition isn't the cause. It looks like the org-required workflow is not dispatched for that event type. Until that's resolved, PRs that start as drafts need auto-merge enabled by hand once they're ready.

kvlonge commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on why ready_for_review never starts this workflow.

This workflow runs as a ruleset-required workflow, and GitHub ignores the types: filter for those. It runs only on the default activity types: pull_request / pull_request_target on opened, synchronize and reopened, and merge_group on checks_requested. See "Supported event triggers" under "Require workflows to pass before merging" in GitHub's rulesets documentation.

So the ready_for_review entry in on.pull_request.types has no effect. A pull request opened as a draft skips request-auto-merge on opened because of the draft condition, and gets no run when it is marked ready. The workflow only requests auto-merge after the next push to the branch.

Seen twice in sqlstack-io/sqlbuild:

  • #1569 was marked ready at 09:01 UTC on 2026-11-18. GitHub started the repository's own Verify workflow for ready_for_review but did not start Request Auto-Merge. Its only run on that head is the opened run, where request-auto-merge was skipped.
  • An earlier draft showed the same thing: no run on ready_for_review, then a run on the next synchronize.

The agreed practice stays: whoever marks a draft ready enables auto-merge by hand with gh pr merge <number> --auto --match-head-commit <head sha>.

kvlonge commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Another merge-queue interaction, this time with the Release Please pull request.

When a commit lands on main while the release pull request is in the merge queue, Release Please cannot update the release branch. Seen in sqlstack-io/sqlbuild:

  • Release pull request #1575 (0.246.0) entered the queue at 11:46 UTC with head 341743bdb, then listing only #1573.
  • #1571 then merged to main as 1cd8411. The Release Please run on that push, https://github.com/sqlstack-io/sqlbuild/actions/runs/44298482657, built the regenerated release commit ffe1fbe and then failed with Error updating ref heads/release-please--branches--main--components--sqlbuild to ffe1fbe2aa1bcad68a645b5c35f670ed1d786438. The branch has no protection, so the refusal comes from the pull request being queued. The log itself gives no reason.
  • While queued, the release pull request shows auto-merge off and merge state UNKNOWN, which makes it look stuck.
  • Its merge group 0ac57cb was built on top of #1571 and #1572. So the v0.246.0 tag contains both, but the release notes Release Please generated list only #1573. The next release won't list them either, because they land before the release commit.

We let it merge, since dequeuing costs a full queue cycle, and left the release notes and CHANGELOG.md as generated.

Options if this keeps happening: hold other pull requests out of the queue while a release pull request is queued, or have the release merge step dequeue and re-request the release pull request when a Release Please run fails to update its branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant