Port from https://github.com/github/hubot-scripts/src/scripts/ambush.coffee