-
-
Notifications
You must be signed in to change notification settings - Fork 28
41 lines (37 loc) · 1.13 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
# Automerge Dependabot PRs
# This workflow will automatically approve and merge Dependabot PRs
# Autogenerated from nanosaurci
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@v4
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" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
if: ${{ steps.find_pr.outputs.PR_NUMBER != '' }}
run: gh pr merge --auto --squash "${{ steps.find_pr.outputs.PR_NUMBER }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}