[ISSUE #4291]♻️Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability#4292
[ISSUE #4291]♻️Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability#4292
Conversation
…o-merge actions for improved clarity and maintainability
|
🔊@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💥. |
|
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughAdds two dedicated GitHub Actions workflows: Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
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. Comment |
There was a problem hiding this comment.
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.ymlworkflow that triggers after CI completion - Created standalone
auto-merge.ymlworkflow 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.
.github/workflows/auto-merge.yml
Outdated
| if: > | ||
| github.event.workflow_run.event == 'pull_request' && | ||
| github.event.workflow_run.conclusion == 'success' |
There was a problem hiding this comment.
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.
| if: > | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion == 'success' | |
| if: github.event.workflow_run.conclusion == 'success' |
| uses: pascalgn/automerge-action@v0.16.4 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
| MERGE_LABELS: "auto merge" |
There was a problem hiding this comment.
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.
.github/workflows/auto-merge.yml
Outdated
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
There was a problem hiding this comment.
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.
| - name: Checkout code | |
| uses: actions/checkout@v4 |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
…o-merge actions for improved clarity and maintainability
|
🔊@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
|
🔊@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💥. |
Which Issue(s) This PR Fixes(Closes)
Fixes #4291
Brief Description
How Did You Test This Change?
Summary by CodeRabbit