Skip to content

Dependabot auto-merge PRs if CI Testing succeeds #1409

Dependabot auto-merge PRs if CI Testing succeeds

Dependabot auto-merge PRs if CI Testing succeeds #1409

name: Dependabot auto-merge PRs if CI Testing succeeds
on:
pull_request_target:
workflow_run:
workflows: ['CI Testing']
types:
- completed
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }} && ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Enable auto-merge for Dependabot PRs
# if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --rebase --delete-branch "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}