File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Auto-merge Dependabot PRs
2+
3+ # Specify which events trigger this workflow
4+ on :
5+ pull_request :
6+ types :
7+ - opened
8+ - synchronize
9+ - reopened
10+ check_suite :
11+ types :
12+ - completed
13+
14+ # Restrict permissions to what is needed
15+ permissions :
16+ pull-requests : write
17+ statuses : read
18+
19+ jobs :
20+ auto-merge :
21+ runs-on : ubuntu-latest
22+ if : |
23+ github.event.pull_request.user.login == 'dependabot[bot]' ||
24+ github.event.pull_request.user.login == 'dependabot-preview[bot]'
25+ env :
26+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
27+
28+ steps :
29+ - name : Checkout code
30+ uses : actions/checkout@v3
31+
32+ - name : Check if all checks passed
33+ run : |
34+ if [[ -z "${{ github.event.check_suite.conclusion }}" || "${{ github.event.check_suite.conclusion }}" != "success" ]]; then
35+ echo "Checks not successful or invalid state, skipping merge."
36+ exit 0
37+ fi
38+
39+ - name : Auto-merge if checks passed
40+ run : |
41+ gh pr merge ${{ github.event.pull_request.number }} --squash --auto --repo ${{ github.repository }}
42+
43+ - name : Comment on PR if merged
44+ run : |
45+ gh pr comment ${{ github.event.pull_request.number }} --body "This PR has been automatically merged as all checks passed."
You can’t perform that action at this time.
0 commit comments