File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Auto-merge dependency PRs
2+
3+ on :
4+ pull_request_target :
5+ types : [opened, synchronize, reopened]
6+
7+ permissions :
8+ contents : write
9+ pull-requests : write
10+
11+ jobs :
12+ auto-merge :
13+ runs-on : ubuntu-latest
14+ if : >-
15+ github.event.pull_request.user.login == 'dependabot[bot]' ||
16+ github.event.pull_request.user.login == 'renovate[bot]'
17+ steps :
18+ - name : Approve PR
19+ env :
20+ PR_URL : ${{ github.event.pull_request.html_url }}
21+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22+ run : gh pr review --approve "$PR_URL"
23+
24+ - name : Enable auto-merge
25+ env :
26+ PR_URL : ${{ github.event.pull_request.html_url }}
27+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28+ REPO : ${{ github.repository }}
29+ run : |
30+ STRATEGY=$(gh api "repos/$REPO" --jq '
31+ if .allow_squash_merge then "--squash"
32+ elif .allow_merge_commit then "--merge"
33+ elif .allow_rebase_merge then "--rebase"
34+ else "--merge" end')
35+ gh pr merge --auto "$STRATEGY" "$PR_URL"
You can’t perform that action at this time.
0 commit comments