From 013c7aa58bfa970e5fca3860679d89db9e181837 Mon Sep 17 00:00:00 2001 From: Gareth Flowers Date: Fri, 26 Jul 2024 21:01:37 +0000 Subject: [PATCH] chore(github): add dependabot auto merge workflow --- .github/workflows/dependabot-auto.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/dependabot-auto.yml diff --git a/.github/workflows/dependabot-auto.yml b/.github/workflows/dependabot-auto.yml new file mode 100644 index 0000000..35f33ac --- /dev/null +++ b/.github/workflows/dependabot-auto.yml @@ -0,0 +1,26 @@ +name: Dependabot PR Approve and Merge +on: pull_request_target +permissions: + contents: write + pull-requests: write +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Dependabot Metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Enable auto-merge for Dependabot PRs + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}