/MugBot

Made for personal use, but could be used by anyone. Post a message to a Mattermost channel when a user has a PR merged for the first time. Reminds us to send them a mug

Primary LanguageC#GNU General Public License v3.0GPL-3.0

MugBot

This is a single-purpose bot used to notify a channel on Mattermost that a user has had their pull request merged for the first time.

Codacy Badge Docker Build Status Docker Stars Docker Pulls

Deployment

Recommended - Use pre-built container:

  • Create a directory to store the bot's config file, e.g /opt/bot/mugbot (${YOUR_DIRECTORY})
  • Create the config file in ${YOUR_DIRECTORY}. Read below for details
docker run -d --restart=always \
           -v ${YOUR_DIRECTORY}:/config/ \
           -p ${YOUR_PORT}:8080 --name mugbot \           
           promofaux/mugbot:latest

${YOUR_PORT} is the port your bot will be listening on

On the Github side of things, add a webhook to your repository with a Content Type of application/json, then choose the Let me select individual events radio button, and make sure that only Pull request is ticked.

Configuration

{
  "MmConfig": {
    "WebhookUrl": "Your incoming webhook URL",
    "Channel": "town-square",
    "Username": "MugBot",
    "IconUrl": "Image URL for bot icon"
  },
  "Secret": "github Secret configured in webhook", 
  "CelebrationEmoji": "optional emjoji e.g :celebrate:",
  "CustomString": "@promofaux - Please send them a mug!",
  "IgnoredUsers": [ 
    "PromoFaux"  
  ]
}

CelebrationEmoji and CustomString can be null.

The IgnoredUsers array will be automatically populated as new users PRs are merged, so as not to send out duplicate messages.