Skip to content

Commit 2877dee

Browse files
committed
ci: trusted auto-approve and merge
1 parent 7133c36 commit 2877dee

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Trusted PR Auto-Approve and Merge
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, ready_for_review]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
trusted-automerge:
13+
if: github.event.pull_request.user.login == 'milesburton' || github.event.pull_request.user.login == 'dependabot[bot]'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Auto approve trusted PR
17+
uses: hmarr/auto-approve-action@v4
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Attempt admin merge (bypass when permitted)
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
PR_URL: ${{ github.event.pull_request.html_url }}
25+
run: |
26+
gh pr merge "$PR_URL" --squash --delete-branch --admin || \
27+
gh pr merge "$PR_URL" --merge --delete-branch --admin || \
28+
gh pr merge "$PR_URL" --auto --squash --delete-branch

0 commit comments

Comments
 (0)