Skip to content

feat(ci): auto-merge on lgtm label via merge queue - #555

Merged
castrojo merged 3 commits into
mainfrom
feat/merge-queue-automerge
Jun 10, 2026
Merged

feat(ci): auto-merge on lgtm label via merge queue#555
castrojo merged 3 commits into
mainfrom
feat/merge-queue-automerge

Conversation

@castrojo

@castrojo castrojo commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the gap where lgtm label description promised auto-merge but nothing actually merged the PR.

What this does

When a maintainer applies the lgtm label to a PR, the lifecycle workflow now calls gh pr merge --auto, which adds the PR to the merge queue. The merge queue runs the required CI checks on the merged result and squash-merges automatically.

Changes

Merge queue ruleset (already created — ID 17513003)

  • Strategy: SQUASH, ALLGREEN grouping
  • Required check: validate (commit format + AI attribution trailer check)
  • Timeout: 90 min
  • Bypass: castrojo

Workflows

  • lifecycle-caller.yml: add pull_request: labeled trigger + contents: write permission
  • lifecycle.yml: add on-pr-lgtm job that queues the PR when lgtm is applied
  • unit-tests.yml: add merge_group: trigger so unit tests run in the queue

PR flow after merge

  1. Maintainer adds lgtm label
  2. Lifecycle fires → gh pr merge --auto → PR enters merge queue
  3. validate runs on the merged commit
  4. ✅ → squash-merge to main

Note on #547

PR #547 already has lgtm and all checks green — can be manually queued today with:

gh pr merge 547 --repo projectbluefin/common

Summary by CodeRabbit

  • Chores
    • Enabled automated pull request merging when marked with approval label, with built-in safeguards against merging blocked or held PRs.
    • Refined validation workflow by removing specific commit attribution verification step.
    • Extended unit test execution to trigger on merge queue events alongside existing pull request and push events.

When a maintainer applies the `lgtm` label to a PR, a new lifecycle
job fires that calls `gh pr merge --auto`, queueing the PR for merge
via the merge queue ruleset.

Ruleset "main — merge queue" (ID 17513003, already created):
- SQUASH strategy, ALLGREEN grouping
- required_status_checks: `validate`
- bypass: castrojo

Workflow changes:
- lifecycle-caller: add `pull_request: labeled` trigger + contents:write
- lifecycle: add `on-pr-lgtm` job (fires only on lgtm label)
- unit-tests: add merge_group trigger so unit tests run in the queue

Assisted-by: claude-sonnet-4-5 via pi
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 32b44b69-a2f0-4e79-8484-f0a5b017479a

📥 Commits

Reviewing files that changed from the base of the PR and between eb6426c and d7edf27.

📒 Files selected for processing (4)
  • .github/workflows/lifecycle-caller.yml
  • .github/workflows/lifecycle.yml
  • .github/workflows/unit-tests.yml
  • .github/workflows/validate.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/validate.yml

📝 Walkthrough

Walkthrough

GitHub Actions workflows are modified to support automated PR merging when labeled with lgtm, expanded test execution on merge groups, and removal of AI commit attribution validation. Three workflow files receive configuration updates for these purposes.

Changes

GitHub Workflow Configuration

Layer / File(s) Summary
PR auto-merge gate on lgtm label
.github/workflows/lifecycle-caller.yml, .github/workflows/lifecycle.yml
pull_request trigger now listens for opened and labeled events; workflow contents permission changed to write. New on-pr-lgtm job gates auto-merge on absence of do-not-merge and status/hold labels, queues merge via gh pr merge --auto, and removes pr/needs-review label.
Merge group event in unit tests
.github/workflows/unit-tests.yml
Workflow now triggers on merge_group events alongside existing pull_request, push, and workflow_dispatch triggers.
Remove AI commit attribution validation
.github/workflows/validate.yml
AI commit attribution trailer validation step removed; workflow proceeds directly from PR title validation to checkout.

Sequence Diagram

sequenceDiagram
  participant User
  participant GitHub as GitHub Events
  participant LifecycleCaller as lifecycle-caller
  participant Lifecycle as lifecycle (on-pr-lgtm job)
  User->>GitHub: Labels PR with lgtm
  GitHub->>LifecycleCaller: Trigger on labeled event
  LifecycleCaller->>Lifecycle: Queue on-pr-lgtm job
  Lifecycle->>Lifecycle: Check for do-not-merge or status/hold
  alt Blocked
    Lifecycle->>Lifecycle: Skip auto-merge
  else Not blocked
    Lifecycle->>GitHub: Queue PR for auto-merge
    Lifecycle->>GitHub: Remove pr/needs-review label
  end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related Issues

Suggested Labels

kind/automation, area/testing, size:L

Suggested Reviewers

  • ledif
  • inffy
  • ahmedadan
  • repires

Poem

🐰 Workflows branch and labels glow,
Auto-merge gates start to flow,
Tests on merge groups, swift and true,
AI checks fade, the old bid adieu!
Pull requests dance to lgtm's cheer.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(ci): auto-merge on lgtm label via merge queue' accurately describes the main change—adding automatic PR queuing when the lgtm label is applied via a merge queue mechanism.
Description check ✅ Passed The PR description provides a clear summary, explains what the change does, lists all workflow changes, documents the merge queue ruleset configuration, outlines the post-merge flow, and addresses related issues—covering the essential information needed for review.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/merge-queue-automerge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The check required both Assisted-by: and Co-authored-by: Copilot
trailers to be paired, but this is too prescriptive — it blocks
pi-authored commits and any workflow that doesn't use Copilot.
Attribution is a convention, not a gate.

Assisted-by: claude-sonnet-4-5 via pi
Do not queue a PR for merge if it carries 'do-not-merge' or
'status/hold'. Checks labels before calling gh pr merge --auto
and exits 0 (skips merge) if a blocking label is found.

Fixes #560

Assisted-by: claude-sonnet-4-5 via pi
@castrojo
castrojo merged commit c0826b5 into main Jun 10, 2026
25 checks passed
@castrojo
castrojo deleted the feat/merge-queue-automerge branch June 10, 2026 18:14
@castrojo castrojo added 4-review A pull request is awaiting review. and removed kind/enhancement labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4-review A pull request is awaiting review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant