From b5ac185cad49a905d9e620d3142cdd9f6d32a7b1 Mon Sep 17 00:00:00 2001 From: Damyan Yordanov Date: Mon, 30 Oct 2023 18:41:14 +0100 Subject: [PATCH] Auto-merge dependabot PRs --- .github/workflows/auto-merge.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/auto-merge.yaml diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml new file mode 100644 index 0000000..b87e9d1 --- /dev/null +++ b/.github/workflows/auto-merge.yaml @@ -0,0 +1,26 @@ +name: Dependabot auto-approve +on: pull_request_target + +permissions: + pull-requests: write + contents-requests: write + +jobs: + dependabot: + runs-on: self-hosted + if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1 + - uses: actions/checkout@v4 + - name: Approve a Dependabot PR + run: gh pr review --aprove "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}}