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 09fbc3d commit 53fa8af
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/automerger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Automerge Dependabot PRs'

on:
workflow_run:
workflows:
- 'Lint PR'
- 'Continuous Integration'
- 'CodeQL'
types:
- completed

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 53fa8af

Please sign in to comment.