-
Notifications
You must be signed in to change notification settings - Fork 27
30 lines (23 loc) · 1.02 KB
/
dependabot_automerge.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
# GitHub action to automerge dependabot PRs. Only merges if tests pass due to branch protections in the repo.
name: automerge-dependabot-prs
on: pull_request_target
permissions:
contents: write
pull-requests: write
jobs:
dependabot-automerge:
runs-on: ubuntu-latest
# if actor is dependabot or pre-commit-ci[bot] then run
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' }}
steps:
- name: Auto approve dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'pre-commit-ci[bot]' }}
uses: hmarr/auto-approve-action@v3.1.0
with:
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
# Checkout action is required for token to persist
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}