From 45b1cb280dfcc81b7867337144ba1cd9c14fb327 Mon Sep 17 00:00:00 2001 From: tyler36 Date: Tue, 18 Feb 2025 10:08:52 +0900 Subject: [PATCH] feat: auto-merge dependabot minor and patch PRs (#9) Co-authored-by: tyler36 <7234392+tyler36@users.noreply.github.com> --- .github/workflows/dependabot-auto-pr.yml | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/dependabot-auto-pr.yml diff --git a/.github/workflows/dependabot-auto-pr.yml b/.github/workflows/dependabot-auto-pr.yml new file mode 100644 index 0000000..5b60e3b --- /dev/null +++ b/.github/workflows/dependabot-auto-pr.yml @@ -0,0 +1,39 @@ +name: chore + +on: pull_request + +permissions: + pull-requests: write + contents: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Require status checks to pass before merging for the target branch for Dependabot pull requests. + # This job should only be on projects with comprehensive testing. + dependabot: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == github.event.pull_request.head.repo.full_name + steps: + + - name: "🤖 Dependabot metadata" + id: metadata + uses: dependabot/fetch-metadata@v2.3.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: "🤖 Auto-merge Dependabot PRs for semver MINOR updates" + if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} + run: gh pr merge --auto --rebase "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: "🤖 Auto-merge Dependabot PRs for semver PATCH updates" + if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} + run: gh pr merge --auto --rebase "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}