diff --git a/.github/workflows/merge-dependabot.yml b/.github/workflows/merge-dependabot.yml new file mode 100644 index 0000000..5437feb --- /dev/null +++ b/.github/workflows/merge-dependabot.yml @@ -0,0 +1,33 @@ +name: "Merge updates" +on: + workflow_run: + workflows: ["CI"] + types: ["completed"] + branches: ["dependabot/**"] +jobs: + merge: + name: "Merge" + runs-on: "ubuntu-latest" + permissions: + contents: write + issues: write + pull-requests: write + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + github.actor == 'dependabot[bot]' + steps: + - name: "Merge pull request" + uses: "actions/github-script@v7" + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + script: | + const pullRequest = context.payload.workflow_run.pull_requests[0] + const repository = context.repo + + await github.rest.pulls.merge({ + merge_method: "merge", + owner: repository.owner, + pull_number: pullRequest.number, + repo: repository.repo, + })