-
Notifications
You must be signed in to change notification settings - Fork 233
[ISSUE #4291]♻️Refactor CI workflows to separate auto-approve and auto-merge actions for improved clarity and maintainability #4292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Auto Approve PR | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Rocketmq Rust CI"] | ||
| types: | ||
| - completed | ||
|
|
||
| jobs: | ||
| auto-approve: | ||
| name: Auto Approve PR | ||
| runs-on: ubuntu-latest | ||
| if: > | ||
| github.event.workflow_run.event == 'pull_request' && | ||
| github.event.workflow_run.conclusion == 'success' | ||
| steps: | ||
| - name: Get PR number | ||
| id: pr | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const pulls = await github.rest.pulls.list({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| state: 'open', | ||
| head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}` | ||
| }); | ||
|
|
||
| if (pulls.data.length > 0) { | ||
| return pulls.data[0].number; | ||
| } | ||
| return null; | ||
|
|
||
| - name: Auto approve PR | ||
| if: steps.pr.outputs.result != 'null' | ||
| uses: hmarr/auto-approve-action@v4 | ||
| with: | ||
| github-token: ${{ secrets.BOT_TOKEN }} | ||
| pull-request-number: ${{ steps.pr.outputs.result }} | ||
| review-message: "LGTM - All CI checks passed ✅" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||
| name: Auto Merge PR | ||||||
|
|
||||||
| permissions: | ||||||
| contents: write | ||||||
| pull-requests: write | ||||||
|
|
||||||
| on: | ||||||
| workflow_run: | ||||||
| workflows: ["Auto Approve PR"] | ||||||
| types: | ||||||
| - completed | ||||||
|
|
||||||
| jobs: | ||||||
| auto-merge: | ||||||
| name: Auto Merge PR | ||||||
| runs-on: ubuntu-latest | ||||||
| if: > | ||||||
| github.event.workflow_run.event == 'pull_request' && | ||||||
| github.event.workflow_run.conclusion == 'success' | ||||||
| steps: | ||||||
| - name: Checkout code | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
|
||||||
| - name: Checkout code | |
| uses: actions/checkout@v4 |
Copilot
AI
Nov 16, 2025
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.eventproperty does not exist in the workflow_run context. When a workflow is triggered byworkflow_run, the original event type is not available this way. This condition will likely never be true. Consider removing thegithub.event.workflow_run.eventcheck or retrieving the PR context differently, similar to how it's done in the auto-approve workflow.