Skip to content

Commit

Permalink
Add Dependabot GH-Action - Auto-approve / -merge (#109)
Browse files Browse the repository at this point in the history
* Add Dependabot GH-Action - Auto-approve / -merge

* Better Workflow

* Add to 📄README
  • Loading branch information
lord-haffi authored Oct 17, 2023
1 parent b704e53 commit d743c97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Dependabot auto-approve / -merge
on: pull_request

jobs:
dependabot:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,12 @@ It just requires some manual adjustments/settings depending on your project:
## Contribute

You are very welcome to contribute to this template repository by opening a pull request against the main branch.

### GitHub Actions

- Dependabot auto-approve / -merge:
- If the actor is the Dependabot bot (i.e. on every commit by Dependabot)
the pull request is automatically approved and auto merge gets activated
(using squash merge).
Note that if you haven't enabled "auto merge" for your repository, the auto merge activation will fail.
If you want to use a merge type other than "squash merge" you have to edit the workflow.

0 comments on commit d743c97

Please sign in to comment.