Skip to content

Commit

Permalink
feat: add automerger workflow 🎉
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
  • Loading branch information
vinayakkulkarni committed Feb 25, 2023
1 parent ebea947 commit da9a260
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/automerger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Automerge Dependabot PRs'

on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata 🤖
id: metadata
uses: dependabot/fetch-metadata@v1.3.6
with:
alert-lookup: true
compat-lookup: true
github-token: ${{ secrets.DEPENDABOT_TOKEN }}

- name: Authenticate CLI with PAT 🔐
run: echo "${{ secrets.DEPENDABOT_TOKEN }}" | gh auth login --with-token

- name: Approve Dependabot PRs 👍
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}

- name: Auto-merge Dependabot PRs 🕺
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}

0 comments on commit da9a260

Please sign in to comment.