Skip to content

Commit 85c5ece

Browse files
authored
Merge pull request #111 from github/kh-auto-approve-and-merge
Auto approve and merge dependabot updates
2 parents b4ba76b + 8ceb930 commit 85c5ece

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Auto-approve and merge PR
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
auto_approve:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Approve PR
14+
uses: actions/github-script@v6
15+
with:
16+
github-token: ${{secrets.GITHUB_TOKEN}}
17+
script: |
18+
github.rest.pulls.createReview({
19+
owner: context.payload.repository.owner.login,
20+
repo: context.payload.repository.name,
21+
pull_number: context.payload.pull_request.number,
22+
event: "APPROVE",
23+
})
24+
- name: Enable auto-merge for PR
25+
run: gh pr merge --auto --merge "$PR_URL"
26+
env:
27+
PR_URL: ${{github.event.pull_request.html_url}}
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)