From 7b1e55237a83dcf912cc95f1f9832f0e33a24437 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 30 Apr 2021 12:25:56 +0200 Subject: [PATCH] Add GitHub action to automerge minor and patch updates --- .github/workflows/automerge.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 000000000..342d60508 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,30 @@ +name: Automerge dependency updates + +on: [pull_request] +jobs: + auto_merge: + runs-on: ubuntu-latest + if: | + github.event_name == 'pull_request' && + github.actor == 'dependabot[bot]' + steps: + - name: "@dependabot merge" + uses: actions/github-script@v3 + with: + script: | + const title = context.payload.pull_request.title; + const update_regex = /Update [^ ]* requirement from ~> ([1-9][0-9]*)\.\d+\.\d+ to ~> \1\.\d+\.\d+/; + const update_match = title.match(update_regex); + + if (update_match !== null) { + console.log(`Detected allowed update in '${title}'`); + } else { + return; + } + + github.issues.createComment({ + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name, + issue_number: context.payload.pull_request.number, + body: '@dependabot merge' + })