From 61b295252b15cd4d80362861a0e6fd4cecdb0d88 Mon Sep 17 00:00:00 2001 From: No767 <73260931+No767@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:43:16 -0800 Subject: [PATCH] Implement dependabot auto-merge workflows --- .github/workflows/auto-approve.yml | 14 ++++++++++ .github/workflows/dependabot-auto-merge.yml | 31 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/auto-approve.yml create mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 0000000..e2d1aac --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,14 @@ +name: Auto approve + +on: pull_request_target + +jobs: + auto-approve: + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: github.actor == 'dependabot[bot]' + steps: + - uses: hmarr/auto-approve-action@v3 + with: + github-token: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 0000000..c984293 --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,31 @@ +name: Dependabot Auto-Merge +on: + pull_request_target: + types: + - opened + workflow_run: + workflows: ["Lint", "CodeQL"] + branches: [dev] + types: + - completed + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]'}} + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Enable auto-merge for Dependabot PRs + if: ${{steps.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}}