Skip to content

Commit

Permalink
github: configure dependapot with automatic merging
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleas-k committed Nov 24, 2023
1 parent 982e84c commit 31cd4f3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Basic test trying dependabot
---
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "04:00"
open-pull-requests-limit: 5
rebase-strategy: "disabled"

# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/odc"
schedule:
interval: "daily"
time: "04:00"
groups:
go-deps:
patterns:
- "*" # group all dependency updates into one PR
open-pull-requests-limit: 1
rebase-strategy: "auto"
23 changes: 23 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Taken from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#common-dependabot-automations

name: Dependabot auto-approve and auto-merge
on: pull_request_target

permissions: write-all

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.SCHUTZBOT_GITHUB_ACCESS_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.SCHUTZBOT_GITHUB_ACCESS_TOKEN}}

0 comments on commit 31cd4f3

Please sign in to comment.