Dependabot auto-merge PRs if CI Testing succeeds #1256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |