Skip to content

Commit

Permalink
Add dependabot automation
Browse files Browse the repository at this point in the history
Add dependabot automation, which will automatically approve the PR and
merge it. Merging will only succeed if the JDK17 build succeeds per the
branch ruleset in the GitHub project.

#release/4.10
  • Loading branch information
smcvb committed Oct 10, 2024
1 parent 6f1f112 commit 9f919f2
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/dependabot-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Dependabot Automation
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot-approve:
name: Dependabot PR Automation

runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Retrieve Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve Pull Request
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

dependabot-auto-merge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Retrieve Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Pull Request
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 9f919f2

Please sign in to comment.