-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub action to automerge minor and patch updates
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
}) |