Skip to content

[ISSUE #4291]♻️Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability#4292

Closed
mxsm wants to merge 3 commits intomainfrom
refactor-4291
Closed

[ISSUE #4291]♻️Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability#4292
mxsm wants to merge 3 commits intomainfrom
refactor-4291

Conversation

@mxsm
Copy link
Owner

@mxsm mxsm commented Nov 16, 2025

Which Issue(s) This PR Fixes(Closes)

Fixes #4291

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • Chores
    • Moved PR approval and merge automation out of the main CI and into separate dedicated workflows for clearer automation management.
    • Removed embedded auto-approve/auto-merge jobs from the CI workflow.
    • Enabled verbose Codecov reporting for improved upload diagnostics.

…o-merge actions for improved clarity and maintainability
Copilot AI review requested due to automatic review settings November 16, 2025 14:51
@rocketmq-rust-bot
Copy link
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds two dedicated GitHub Actions workflows: auto-approve.yml to post an LGTM review when the CI workflow succeeds, and auto-merge.yml to automatically merge PRs; removes the previous auto-approve/auto-merge jobs from the main ci.yaml and enables verbose Codecov upload.

Changes

Cohort / File(s) Summary
Auto-Approval Workflow
.github/workflows/auto-approve.yml
New workflow triggered on completion of the "Rocketmq Rust CI" workflow; finds the open PR for the head branch and, if found, submits an LGTM review using a bot token; skips if no PR is found.
Auto-Merge Workflow
.github/workflows/auto-merge.yml
New workflow triggered by PR/check events; runs pascalgn/automerge-action@v0.16.4 with env vars (BOT_TOKEN, MERGE_LABELS=auto merge, MERGE_METHOD=squash, UPDATE_METHOD=rebase, retries, required approvals, etc.).
CI Workflow Refactor
.github/workflows/ci.yaml
Removed the inline Auto Approve PR and Auto Merge PR jobs and their triggers/steps; kept CI checks and updated Codecov upload to use verbose output.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer
    participant GH as GitHub
    participant CI as "Rocketmq Rust CI"
    participant Approve as "Auto-Approve WF"
    participant Merge as "Auto-Merge WF"

    Dev->>GH: Push / open PR
    GH->>CI: Trigger "Rocketmq Rust CI"
    CI->>CI: Run checks
    CI-->>GH: Workflow completes (success)
    GH->>Approve: Workflow run completed event
    Approve->>Approve: Find PR by head branch
    alt PR found
        Approve->>GH: Submit LGTM review (bot)
        GH->>Merge: PR events / approvals trigger
        Merge->>Merge: Validate labels & approvals
        alt Ready to merge
            Merge->>GH: Perform squash+rebase merge
            GH-->>Merge: PR merged
        end
    else No PR
        Approve->>Approve: Skip approval
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify workflow trigger filters and permissions for both new workflows.
  • Confirm BOT_TOKEN secret scope and that write permissions for pull-requests/contents are correctly set.
  • Validate automerge-action environment variables (retries, sleep, approvals) and expected behavior with forks.
  • Check ci.yaml removal of jobs didn't accidentally remove other required steps; verify Codecov verbose flag usage.

Possibly related PRs

Suggested labels

enhancement⚡️

Suggested reviewers

  • TeslaRustor
  • SpaceXCN
  • rocketmq-rust-bot

Poem

🐰 I hopped through YAML, tidy and spry,
Split approvals and merges to let each task fly.
LGTM I deliver with a polite little thump—
Then squash and rebase give the history a jump. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning A codecov verbose setting modification was added to the coverage step in ci.yaml, which is outside the stated refactoring objective of separating auto-approve and auto-merge actions. Remove the codecov verbose setting change or document it as a separate enhancement if intentional; keep this PR focused on the workflow separation refactoring.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: refactoring CI workflows to separate auto-approve and auto-merge actions, which directly matches the changeset modifications.
Linked Issues check ✅ Passed The PR implements the refactoring objective to separate auto-approve and auto-merge actions, with auto-approve.yml and auto-merge.yml created and removed from ci.yaml, though the linked issue lacks specific implementation details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-4291

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2a5095 and 47c1873.

📒 Files selected for processing (2)
  • .github/workflows/auto-approve.yml (1 hunks)
  • .github/workflows/auto-merge.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/auto-merge.yml
  • .github/workflows/auto-approve.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build & Test (windows-latest)

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the CI workflow by extracting the auto-approve and auto-merge jobs from the main ci.yaml file into separate workflow files. The purpose is to improve clarity and maintainability by separating concerns and using GitHub's workflow_run trigger to chain the workflows sequentially.

Key changes:

  • Removed auto-approve and auto-merge jobs from ci.yaml
  • Created standalone auto-approve.yml workflow that triggers after CI completion
  • Created standalone auto-merge.yml workflow that triggers after auto-approve completion

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/ci.yaml Removed auto-approve and auto-merge jobs, keeping only core CI checks
.github/workflows/auto-approve.yml New workflow that auto-approves PRs after successful CI completion
.github/workflows/auto-merge.yml New workflow that auto-merges PRs after successful approval

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 17 to 19
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github.event.workflow_run.event property does not exist in the workflow_run context. When a workflow is triggered by workflow_run, the original event type is not available this way. This condition will likely never be true. Consider removing the github.event.workflow_run.event check or retrieving the PR context differently, similar to how it's done in the auto-approve workflow.

Suggested change
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
if: github.event.workflow_run.conclusion == 'success'

Copilot uses AI. Check for mistakes.
uses: pascalgn/automerge-action@v0.16.4
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
MERGE_LABELS: "auto merge"
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-merge workflow lacks logic to verify that the PR has the 'auto merge' label before attempting to merge. The original implementation in ci.yaml had contains(github.event.pull_request.labels.*.name, 'auto merge') in the if condition, but this check is missing in the new workflow. The MERGE_LABELS environment variable for pascalgn/automerge-action may not work correctly without proper PR context when triggered via workflow_run. Consider adding label verification using actions/github-script to fetch PR details and check for the label.

Copilot uses AI. Check for mistakes.
Comment on lines 21 to 23
- name: Checkout code
uses: actions/checkout@v4

Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkout step may be unnecessary for the pascalgn/automerge-action as it operates via the GitHub API and doesn't require the repository code. Consider removing this step unless it's required for a specific reason.

Suggested change
- name: Checkout code
uses: actions/checkout@v4

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 28.20%. Comparing base (9935697) to head (47c1873).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4292   +/-   ##
=======================================
  Coverage   28.20%   28.20%           
=======================================
  Files         620      620           
  Lines       87826    87826           
=======================================
  Hits        24773    24773           
  Misses      63053    63053           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mxsm mxsm closed this Nov 16, 2025
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Nov 16, 2025
…o-merge actions for improved clarity and maintainability
@mxsm mxsm reopened this Nov 16, 2025
@rocketmq-rust-bot
Copy link
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

…o-merge actions for improved clarity and maintainability
@rocketmq-rust-bot
Copy link
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@mxsm mxsm closed this Nov 16, 2025
@mxsm mxsm deleted the refactor-4291 branch November 16, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge refactor♻️ refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor♻️]Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability

4 participants