From a1e13c56fdc053dac282eca07691723e03f92c77 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Tue, 25 Apr 2023 07:27:34 +0200 Subject: [PATCH] [FEATURE] Automatically approve Dependabot pull requests (#818) This way, we can enforce having an approval before a PR is allowed to get merged. --- .github/workflows/auto-approve.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/auto-approve.yml diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 0000000..587b598 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,29 @@ +# https://docs.github.com/en/github-ae@latest/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions +name: auto-approve + +on: + pull_request: + +permissions: + pull-requests: write + +jobs: + auto-approve: + name: Dependabot auto-approve + + runs-on: ubuntu-22.04 + + 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 + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}