magic-merge-plz
automate github branch merging.
This thing checks your github repos for PRs which are APPROVED and have a magic label added to them. If it finds such PRs it will merge them and delete the branch.
It is useful if you have things that run which prevent merging until they complete, and people have to constantly go back and check their status before doing the merge.
Other things it does
- if a PR has any "changes requested" things, it will thumb down the PR
- if a PR has no "changes requested" and at least one approval, it will thumb up the PR
- if the magic label is added to a PR it will add itself as an assignee, and remove itself if label is removed
- there is an option to have it mark stale PRs with "Stale PR" label.
Requirements
node 6+
Installing
npm install magic-merge-plz
Using
The export of this thing is a class named MagicMerge
the constructor takes a settings object:
settingsorg string org name - catalant settingsrepos array array of repo names in org to check settingslabel string magic label name defaults to 'a magic merge plz' settingsuser string username of user on whose behalf magic-merge will act settingsauth object auth object with password or token settingsstalePrDays number number of days a pr should stay open to get an emitted event about it
the instance of MagicMerge is an EventEmitter, it emits the following events:
- debug (args: message)
- merged (args: pr, repo)
- stale (args: pr, repo)
- warning (args: message)
- rate-limit (args: remainingRequests, minutesUntilReset)
Example
; const magic = org: 'catalant' repos: 'magic-merge-plz' 'hn-webpack' 'hn-nerd-experience' 'hn-enterprise-portal' 'hn-marketing-sales' label: 'a magic merge plz' stalePrDays: 1 username: 'catman' auth: ; // start checking the repos for PRs with the magic merge label which are approvedmagicstart;