Skip to content

Commit

Permalink
🎨 Create dependabot automerge action
Browse files Browse the repository at this point in the history
  • Loading branch information
flaxel committed Nov 1, 2023
1 parent 4f3d981 commit 55df4b7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/template_automerge_dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# see: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
name: Dependabot Auto-Merge

on:
workflow_call:

jobs:
dependabot:

name: auto-merge
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'

steps:
- name: Load dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ jobs:
In this section you can find examples of how to use template workflows. For more information, please take a look at the templates.
### Auto-Merge Dependabot
<details>
<summary>The action can be used to auto-merge a dependabot PR with minor and patch updates.</summary>
```yml
name: Enable Dependabot Auto-Merge

on: pull_request

jobs:
automerge:
uses: Staffbase/gha-workflows/.github/workflows/[email protected]
```
</details>
### AutoDev
<details>
Expand Down

0 comments on commit 55df4b7

Please sign in to comment.