1- name : Auto Approve PR
2-
3- permissions :
4- pull-requests : write
1+ name : Auto Approve Pull Requests
52
63on :
7- workflow_run :
8- workflows : ["Rocketmq Rust CI"]
9- types :
10- - completed
4+ pull_request_target :
5+ types : [ labeled, opened, synchronize, reopened ]
6+
7+ permissions :
8+ pull-requests : read
9+ contents : read
10+ checks : read
1111
1212jobs :
1313 auto-approve :
14- name : Auto Approve PR
1514 runs-on : ubuntu-latest
1615 if : >
17- github.event.workflow_run.event == 'pull_request' &&
18- github.event.workflow_run.conclusion == 'success'
16+ github.event.pull_request.merged == false &&
17+ contains(github.event.pull_request.labels.*.name, 'auto merge')
18+
1919 steps :
20- - name : Get PR number
21- id : pr
22- uses : actions/github-script@v7
20+ - name : Wait for Rocketmq Rust CI to succeed
21+ uses : lewagon/wait-on-check-action@v1.1.0
2322 with :
24- script : |
25- const pulls = await github.rest.pulls.list({
26- owner: context.repo.owner,
27- repo: context.repo.repo,
28- state: 'open',
29- head: `${context.repo.owner}:${context.payload.workflow_run.head_branch}`
30- });
31-
32- if (pulls.data.length > 0) {
33- return pulls.data[0].number;
34- }
35- return null;
23+ token : ${{ secrets.GITHUB_TOKEN }}
24+ ref : ${{ github.event.pull_request.head.sha }}
25+ repo : ${{ github.repository }}
26+ wait-interval : 20
27+ running-workflow-name : " Rocketmq Rust CI"
3628
3729 - name : Auto approve PR
38- if : steps.pr.outputs.result != 'null'
3930 uses : hmarr/auto-approve-action@v4
4031 with :
4132 github-token : ${{ secrets.BOT_TOKEN }}
42- pull-request-number : ${{ steps.pr.outputs.result }}
43- review-message : " LGTM - All CI checks passed ✅ "
33+ pull-request-number : ${{ github.event.pull_request.number }}
34+ review-message : " LGTM✅ All required checks passed. Auto-approved for merge. "
0 commit comments