Skip to content

Commit

Permalink
Improvements to auto-merge action with Dependabot.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlaird committed May 17, 2024
1 parent 4649cbc commit 4e2ffb0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 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 }}
18 changes: 1 addition & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,4 @@ jobs:
validate:
name: Validate
uses: ./.github/workflows/validate.yml
secrets: inherit

automerge:
name: "Auto Approve"
needs: [build, validate]

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
secrets: inherit

0 comments on commit 4e2ffb0

Please sign in to comment.