From ca5f064876c8830ce5b237d26858f66631f4564c Mon Sep 17 00:00:00 2001 From: Cail Young Date: Thu, 30 Jun 2022 14:44:43 +1000 Subject: [PATCH] Create dependabot-automerge.yml --- .github/workflows/dependabot-automerge.yml | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..99bf071 --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,27 @@ +name: "Dependabot Approve and Auto Merge" + +on: + pull_request: + branches: [ main ] + +# Increase the access for the GITHUB_TOKEN +permissions: + # This Allows the GITHUB_TOKEN to approve pull requests + pull-requests: write + # This Allows the GITHUB_TOKEN to auto merge pull requests + contents: write + +env: + PR_URL: ${{github.event.pull_request.html_url}} + # By default, GitHub Actions workflows triggered by Dependabot get a GITHUB_TOKEN with read-only permissions. + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ (github.actor == 'dependabot[bot]') && (contains(github.head_ref, 'dependabot')) }} + steps: + - name: Approve a dependabot created PR + run: gh pr review --approve "$PR_URL" + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL"