Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Create dependabot automerge action #187

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-22.04
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"
flaxel marked this conversation as resolved.
Show resolved Hide resolved
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ 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>

The action is called by creating a PR. Dependabot must have ownership of the corresponding dependency files in order to be able to merge the PRs.

```yml
name: Enable Dependabot Auto-Merge

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
uses: Staffbase/gha-workflows/.github/workflows/[email protected]
```
</details>

### AutoDev

<details>
Expand Down