GitHub bot to automatically merge PRs matching certain criteria.
Last updated 3 months ago by andersdjohnson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install github-mergerine 
SYNC missed versions from official npm registry.


Merging as easy as a hot knife through margarine.

npm Travis

A GitHub bot to automatically merge pull requests (PRs) matching certain search query, once passing status and approved by user with write permisssions to base branch, if matches configured labels, etc.

Helps resolve contention in large applications due to the serialization of merges and long continuous integration jobs.


npm install -g github-mergerine (copy)


yarn global add github-mergerine (copy)

or use npx (see below).


Mergerine can be configured variously with environment variables and/or a configuration file.

Configuration file

Example: mergerine.example.json


String Optional.

GitHub API token to use for read/write operations.

Overridden by environment variable MERGERINE_GITHUB_TOKEN.


Boolean Optional. Default: false

Whether or not to actually merge or do any write operations.

Overridden by environment variable MERGERINE_DRY.


Number|String Optional. Default: '2 min'

The poll interval - how often to check for pull requests. Supports an integer as milliseconds or a human duration format supported by timestring, such as '2 min' or '1m 30secs' or '1 hr 25m 18s'.

Overridden by environment variable MERGERINE_INTERVAL.


Boolean Optional. Default: false

Whether to delete pull request branches after merging.

Overridden by environment variable MERGERINE_DELETE_BRANCH_AFTER_MERGE.


Boolean Optional. Default false.

Whether to override the default GitHub merge commit message with a simple one with the format ${pull.title} (#${pull.number}).


Object Optional.

A commitlint configuration if you want to ensure pull request titles match a pattern, since they become the merge commit message with mergeCommitMessageSimple.


Array Required.

A list of repositories to manage.


String Optional. Default:

Base URL for the API endpoint of your GitHub host, e.g.,


String Required.

Owner (user or organization) of the repository.


String Required.

Name of the repository.


String Required.

A GitHub search query to generate the initial list of pull requests to consider.


"repo:your-owner/your-repo is:pr is:open review:approved label:merge -label:\"no merge\" base:master"

Supports additional special syntax for relative dates (note the minus sign for past) using, e.g., ${date(-2w)}, with timestring syntax:

"created:<${date(-2d)} updated:<${date(-4w)}"



Array<String> Optional.

Labels to require before considering pull requests.


Array<String> Optional.

Labels with which to exclude pull requests.


Array<String> Optional.

Labels with which to prioritize pull requests at the front of the queue.


Array<Object> Optional.

Use to configure custom restrictions, such as requiring a minimum number of approval(s) from given team(s) by ID. Example:

    "teams": [
        "id": "123",
        "approvals": 2

"created"|"updated" Optional. Default: "created"

Date field by which to sort the pull requests, which direction in repos[].direction.


"asc"|"desc" Optional. Default: "desc"

Direction which to sort the pull requests, given repos[].sort. Defaults to last in, first out - latest are merged first.


"merge"|"squash"|"rebase" Optional. Default: "merge"

Merge method to use, per


Repo-level override for phases.


Repo-level override for mergeCommitMessageSimple.


String Optional. Default: undefined

A regular expression string to match URLs for which to use full request/response logging.


Array<String> Optional: Default ["merge", "update"].

Controls which phases are run - use this to disable either updating or merging, if you only want one or the other of these behaviors.


Boolean|Number Optional. Default undefined.

Setting this to a port number (or to true or 0 for automatic port selection) will, when polling, start server to expose a health endpoint at /health that will, when the running instance is operating normally, respond with HTTP 200 and body:


which is of content type application/health+json per the IETF RFC.

This can be used by systems hosting or managing a mergerine instance to ping to check that it is still running and hasn't crashed.

Environment variables

# Required (if not in configuration file):

# Optional, config path, default="./mergerine.json", for example see below:
export MERGERINE_CONFIG=/path/to/your/config/mergerine.json

# Optional, number of milliseconds for poll interval, default=120000 (2 minutes):
#  (also supports human durations like "2min" or "1 hour" via

# Optional, dry mode, if "true" then don't actually execute decision, default=undefined:
export MERGERINE_DRY=true

# Optional, for logs:
export DEBUG=mergerine:*


If you installed globally, or have local node modules bin in your PATH, you can use this command to start polling:


or use npx so you don't have to explicitly install globally:

npx github-mergerine

To configure inline:



This will simply start polling immediately. We may expose other methods in the future.

import mergerine from 'github-mergerine'

// now running...


  • add branch whitelist/blacklist for pull list mode (already supported in search mode)
  • add status checks in pull list mode (already supported in search mode)
  • dry mode per repo in config
  • additional sorting/prioritization options

Current Tags

  • 1.15.0                                ...           latest (3 months ago)
  • 1.10.0-0                                ...           next (2 years ago)

36 Versions

  • 1.15.0                                ...           3 months ago
  • 1.14.0                                ...           10 months ago
  • 1.13.0                                ...           a year ago
  • 1.12.3                                ...           a year ago
  • 1.12.2                                ...           a year ago
  • 1.12.1                                ...           a year ago
  • 1.12.0                                ...           a year ago
  • 1.11.0                                ...           a year ago
  • 1.10.1                                ...           2 years ago
  • 1.10.0                                ...           2 years ago
  • 1.10.0-0                                ...           2 years ago
  • 1.9.0                                ...           2 years ago
  • 1.8.0                                ...           2 years ago
  • 1.8.0-alpha.3                                ...           2 years ago
  • 1.8.0-alpha.2                                ...           2 years ago
  • 1.8.0-alpha.1                                ...           2 years ago
  • 1.8.0-alpha                                ...           2 years ago
  • 1.7.2                                ...           2 years ago
  • 1.7.1                                ...           2 years ago
  • 1.7.0                                ...           2 years ago
  • 1.6.6                                ...           2 years ago
  • 1.6.5                                ...           2 years ago
  • 1.6.4                                ...           2 years ago
  • 1.6.3                                ...           2 years ago
  • 1.6.2                                ...           2 years ago
  • 1.6.1                                ...           2 years ago
  • 1.6.0                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.5                                ...           2 years ago
  • 1.4.2 [deprecated]           ...           3 years ago
  • 1.3.1 [deprecated]           ...           3 years ago
  • 1.3.0 [deprecated]           ...           3 years ago
  • 1.2.0 [deprecated]           ...           3 years ago
  • 1.1.1 [deprecated]           ...           3 years ago
  • 1.1.0 [deprecated]           ...           3 years ago
  • 1.0.5 [deprecated]           ...           3 years ago
Maintainers (1)
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (15)
Dev Dependencies (21)
Dependents (0)

Copyright 2014 - 2016 © |