From 8ceb93065361b4c100064d39774147752098bac6 Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:29:41 -0400 Subject: [PATCH] Auto approve and merge dependabot updates --- .github/workflows/auto-approve-and-merge.yml | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/auto-approve-and-merge.yml diff --git a/.github/workflows/auto-approve-and-merge.yml b/.github/workflows/auto-approve-and-merge.yml new file mode 100644 index 0000000..baa04d9 --- /dev/null +++ b/.github/workflows/auto-approve-and-merge.yml @@ -0,0 +1,28 @@ +name: Auto-approve and merge PR +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + auto_approve: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Approve PR + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.pulls.createReview({ + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name, + pull_number: context.payload.pull_request.number, + event: "APPROVE", + }) + - name: Enable auto-merge for PR + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file