From 7d9cc5059729168ce3a0a60313492bf3f1e9df06 Mon Sep 17 00:00:00 2001 From: Conicaw Date: Wed, 5 Jul 2023 18:03:40 -0500 Subject: [PATCH] ci(auto-merge): add auto-merge Add auto-merge --- .github/workflows/auto-merge.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/auto-merge.yml diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 0000000..0ce0bed --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,33 @@ +name: auto-merge + +on: + pull_request_target: + types: + - opened + +permissions: + pull-requests: write + contents: write + +jobs: + auto-merge: + if: ${{ github.actor == 'dependabot[bot]' }} + runs-on: ubuntu-latest + steps: + - name: Dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.6.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Approve Pull Request + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr review -R "${{ github.repository }}" --approve "${{ github.event.pull_request.number }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Enable auto-merge for Dependabot PRs + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr merge -R "${{ github.repository }}" --merge --auto "${{ github.event.pull_request.number }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}