Auto approve & merge dependabot patch upgrade PRs (#30191)

Adapted from the [Github documentation][doc]. This version
approves all patch upgrades to any dependency. Not sure if
we have any dependency that must always be reviewed manually.

[doc]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2023-08-24 20:28:25 +05:30 committed by GitHub
parent acf7fdb90c
commit 3a17a88f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

25
.github/workflows/dependabot-pr.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: Approve & merge successful dependabot patch upgrade PRs
on: pull_request
permissions:
content: write
pull-requests: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve the PR & enable auto-merge
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}