Skip to content

Commit

Permalink
Better implementation for auto-merge of Dependabot PRs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlaird committed May 17, 2024
1 parent 0b64290 commit 801aca8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Auto-Merge Dependabot PRs

on:
pull_request:

jobs:
automerge:
name: Auto-Merge Dependabot PRs

runs-on: ubuntu-latest

permissions:
pull-requests: write
contents: write

if: github.actor == 'dependabot[bot]'
steps:
- name: Get Dependabot metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge
run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 1 addition & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,4 @@ jobs:
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
directory: ./build/coverage

automerge:
name: "Auto Approve"
needs: build
runs-on: ubuntu-latest

permissions:
pull-requests: write
contents: write

steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
target: major
use-github-auto-merge: true
directory: ./build/coverage

0 comments on commit 801aca8

Please sign in to comment.