-
-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (41 loc) · 1.3 KB
/
auto-merge-dependabot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Auto-approve and merge Dependabot PRs
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
jobs:
auto-approve:
runs-on: ubuntu-latest
steps:
- name: Auto-approve Dependabot PR
if: github.actor == 'dependabot[bot]'
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-merge:
needs: auto-approve
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Find PR number
id: find_pr
run: |
PR_NUMBER=$(gh pr list --state open --author "dependabot[bot]" --json number --jq '.[0].number')
echo "PR_NUMBER=$PR_NUMBER"
echo "::set-output name=PR_NUMBER::$PR_NUMBER"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug PR Number
run: |
echo "Retrieved PR_NUMBER: $PR_NUMBER"
echo "Retrieved steps.find_pr.outputs.PR_NUMBER: ${{ steps.find_pr.outputs.PR_NUMBER }}"
env:
PR_NUMBER: ${{ env.PR_NUMBER }}
- name: Enable auto-merge
if: ${{ steps.find_pr.outputs.PR_NUMBER != '' }}
run: gh pr merge --auto --squash "$PR_NUMBER"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}