• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub plugin for Mattermost

Mattermost GitHub Plugin

Build Status Code Coverage Release HW

Maintainer: @hanzei Co-Maintainer: @larkox

A GitHub plugin for Mattermost. Supports GitHub SaaS and Enterprise versions.

Table of Contents

GitHub plugin screenshot

Audience

This guide is intended for Mattermost System Admins setting up the GitHub plugin, Mattermost users who want information about the plugin functionality, and Mattermost users who want to connect their GitHub account to Mattermost. For more information about contributing to this plugin, visit the Development section.

License

This repository is licensed under the Apache 2.0 License.

About the GitHub Plugin

The Mattermost GitHub plugin uses a webhook to connect your GitHub account to Mattermost to listen for incoming GitHub events. Events notifications are via DM in Mattermost. The Events donโ€™t need separate configuration.

After a System Admin has configured the GitHub plugin, run /github connect in a Mattermost channel to connect your Mattermost and GitHub accounts.

Once connected, you'll have access to the following features:

  • Daily reminders - The first time you log in to Mattermost each day, get a post letting you know what issues and pull requests need your attention.
  • Notifications - Get a direct message in Mattermost when someone mentions you, requests your review, comments on or modifies one of your pull requests/issues, or assigns you on GitHub.
  • Post actions - Create a GitHub issue from a post or attach a post message to an issue. Hover over a post to reveal the post actions menu and click More Actions (...).
  • Sidebar buttons - Stay up-to-date with how many reviews, unread messages, assignments, and open pull requests you have with buttons in the Mattermost sidebar.
  • Slash commands - Interact with the GitHub plugin using the /github slash command. Read more about slash commands here.

Before You Start

This guide assumes:

  • You have a GitHub account.
  • You're a Mattermost System Admin.
  • You're running Mattermost v5.12 or higher.

Configuration

GitHub plugin configuration starts by registering an OAuth app in GitHub and ends in Mattermost.

Note: If you're using GitHub Enterprise, replace all GitHub links below with your GitHub Enterprise URL.

You can use the /github setup command to streamline the configuration process.

Step 1: Register an OAuth Application in GitHub

You must first register the Mattermost GitHub Plugin as an authorized OAuth app regardless of whether you're setting up the GitHub plugin as a system admin or a Mattermost user.

  1. Go to https://github.com/settings/applications/new to register an OAuth app.
  2. Set the following values:
    • Application name: Mattermost GitHub Plugin - <your company name>
    • Homepage URL: https://github.com/mattermost/mattermost-plugin-github
    • Authorization callback URL: https://your-mattermost-url.com/plugins/github/oauth/complete, replacing https://your-mattermost-url.com with your Mattermost URL. This value needs to match the Mattermost server URL that you or your users users log in to.
  3. Submit.
  4. Click Generate a new client secret and provide your GitHub password to continue.
  5. Copy the Client ID and Client Secret in the resulting screen.
  6. Click on both Generate buttons in Webhook Secret and At Rest Encryption Key.
  7. Once you've successfully registered the Mattermost GitHub Plugin as an authorized OAuth app, switch to Mattermost and run /github connect in a Mattermost channel. You should receive a Direct Message from the GitHub plugin about the features available to you.

A System Admin performs the remaining steps: 7. Go to System Console > Plugins > GitHub and enter the GitHub OAuth Client ID and GitHub OAuth Client Secret you copied in a previous step. 8. Hit Save.

Step 2: Create a Webhook in GitHub

As a system admin, you must create a webhook for each organization you want to receive notifications for or subscribe to.

  1. In System Console > Plugins > GitHub, generate a new value for Webhook Secret. Copy it, as you will use it in a later step.
  2. Hit Save to save the secret.
  3. Go to the Settings page of your GitHub organization you want to send notifications from, then select Webhooks in the sidebar.
  4. Click Add Webhook.
  5. Set the following values:
    • Payload URL: https://your-mattermost-url.com/plugins/github/webhook, replacing https://your-mattermost-url.com with your Mattermost URL.
    • Content Type: application/json
    • Secret: the webhook secret you copied previously.
  6. Select Let me select individual events for "Which events would you like to trigger this webhook?".
  7. Select the following events: Branch or Tag creation, Branch or Tag deletion, Issue comments, Issues, Pull requests, Pull request review, Pull request review comments, Pushes, Stars.
  8. Hit Add Webhook to save it.

If you have multiple organizations, repeat the process starting from step 3 to create a webhook for each organization.

Step 3: Configure the Plugin in Mattermost

As a System Admin, if you have an existing Mattermost user account with the name github, the plugin will post using the github account but without a BOT tag.

To prevent this, either:

  • Convert the github user to a bot account by running mattermost user convert github --bot in the CLI.

or

  • If the user is an existing user account you want to preserve, change its username and restart the Mattermost server. Once restarted, the plugin will create a bot account with the name github.

Note: For v0.9.0 and earlier of the GitHub plugin, instead of using bot accounts, set the username the plugin is attached to in System Console > Plugins > GitHub.

Generate a Key

Open System Console > Plugins > GitHub and do the following:

  1. Generate a new value for At Rest Encryption Key.
  2. (Optional) GitHub Organization: Lock the plugin to a single GitHub organization by setting this field to the name of your GitHub organization.
  3. (Optional) Enable Private Repositories: Allow the plugin to receive notifications from private repositories by setting this value to true.
  4. (Enterprise Only) Enterprise Base URL and Enterprise Upload URL: Set these values to your GitHub Enterprise URLs, e.g. https://github.example.com. The Base and Upload URLs are often the same. When enabled, existing users must reconnect their accounts to gain access to private repositories. Affected users will be notified by the plugin once private repositories are enabled.
  5. Hit Save.
  6. Go to System Console > Plugins > Management and click Enable to enable the GitHub plugin.

You're all set!

Using the Plugin

Once configuration is complete, run the /github connect slash command from any channel within Mattermost to connect your Mattermost account with GitHub.

Onboarding Your Users

When youโ€™ve tested the plugin and confirmed itโ€™s working, notify your team so they can connect their GitHub account to Mattermost and get started. Copy and paste the text below, edit it to suit your requirements, and send it out.

Hi team,

We've set up the Mattermost GitHub plugin, so you can get notifications from GitHub in Mattermost. To get started, run the /github connect slash command from any channel within Mattermost to connect your Mattermost account with GitHub. Then, take a look at the slash commands section for details about how to use the plugin.

Slash Commands

  • Autocomplete slash commands - Explore all the available slash commands by typing / in the text input box - the autocomplete suggestions help by providing a format example in black text and a short description of the slash command in grey text. Visit the executing commands documentation for more details.

  • Subscribe to a repository - Use /github subscriptions add to subscribe a Mattermost channel to receive notifications for new pull requests, issues, branch creation, and more in a GitHub repository.

    • For instance, to post notifications for issues, issue comments, and pull requests matching the label Help Wanted from mattermost/mattermost-server, use:
    /github subscriptions add mattermost/mattermost-server --features issues,pulls,issue_comments,label:"Help Wanted"
    
    • The following flags are supported:
      • --features: comma-delimited list of one or more of: issues, pulls, pulls_merged, pushes, creates, deletes, issue_creations, issue_comments, pull_reviews, label:"labelname". Defaults to pulls,issues,creates,deletes.
      • --exclude-org-member: events triggered by organization members will not be delivered. It will be locked to the organization provided in the plugin configuration and it will only work for users whose membership is public. Note that organization members and collaborators are not the same.
      • --render-style: notifications will be delivered in the specified style (for example, the body of a pull request will not be displayed). Supported values are collapsed, skip-body or default (same as omitting the flag).
  • Get to do items - Use /github todo to get an ephemeral message with items to do in GitHub, including a list of unread messages and pull requests awaiting your review.

  • Update settings - Use /github settings to update your settings for notifications and daily reminders.

  • Setup GitHub integration - Use /github setup to configure the integration between GitHub and Mattermost. This command has the following subcommands:

    • /github setup oauth: Sets up the OAuth2 application in GitHub, establishing the necessary authorization connection between GitHub and Mattermost.
    • /github setup webhook: Creates a webhook from GitHub to Mattermost, allowing real-time notifications and updates from GitHub to be sent to Mattermost channels.
    • /github setup announce: Sends a message to designated channels in Mattermost, announcing the availability of the GitHub integration for team members to use.
  • And more! - Run /github help to see what else the slash command can do.

Frequently Asked Questions

How do I connect a repository instead of an organization?

Set up your GitHub webhook from the repository instead of the organization. Notifications and subscriptions will then be sent only for repositories you create webhooks for. The reminder and /github todo will still search the whole organization, but only list items assigned to you.

How do I send notifications when a certain label is applied?

Suppose you want to send notifications to a Mattermost channel when Severity/Critical label is applied to any issue in the mattermost/mattermost-plugin-github repository. Then, use this command to subscribe to these notifications:

/github subscriptions add mattermost/mattermost-plugin-github issues,label:"Severity/Critical"

How do I share feedback on this plugin?

Feel free to create a GitHub issue or join the GitHub Plugin channel on our community Mattermost instance to discuss.

How does the plugin save user data for each connected GitHub user?

GitHub user tokens are AES encrypted with an At Rest Encryption Key configured in the plugin's settings page. Once encrypted, the tokens are saved in the PluginKeyValueStore table in your Mattermost database.

Development

This plugin contains both a server and web app portion. Read our documentation about the Developer Workflow and Developer Setup for more information about developing and extending plugins.

Playwright e2e tests

In order to get your environment set up to run Playwright tests, please see the setup guide at e2e/playwright.

More Repositories

1

mattermost

Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
TypeScript
30,433
star
2

focalboard

Focalboard is an open source, self-hosted alternative to Trello, Notion, and Asana.
TypeScript
20,596
star
3

mattermost-webapp

Archived web app of Mattermost. Moved to the monorepo: https://github.com/mattermost/mattermost
TypeScript
2,290
star
4

desktop

Mattermost Desktop application for Windows, Mac and Linux
TypeScript
1,921
star
5

mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
TypeScript
1,898
star
6

mattermost-docker

Deprecated
Shell
964
star
7

docker

Install Mattermost server via Docker
Shell
320
star
8

mattermost-push-proxy

Go
217
star
9

docs

Mattermost documentation
Python
205
star
10

mattermost-redux

Redux for Mattermost
JavaScript
200
star
11

mattermost-plugin-jitsi

Jitsi plugin for Mattermost ๐Ÿ”Œ
Go
183
star
12

mattermost-android-classic

Mattermost app for Android phones and tablets
Java
175
star
13

mattermost-bot-sample-golang

Go
170
star
14

openops

Open source stack for applying AI to workflows in secure environments
Shell
159
star
15

mattermost-ios-classic

Mattermost iOS application source code
Swift
156
star
16

mattermost-helm

Mattermost Helm charts for Kubernetes
Smarty
153
star
17

mattermost-plugin-gitlab

GitLab plugin for Mattermost
JavaScript
136
star
18

mattermost-plugin-ai

Mattermost Copilot plugin supporting multiple LLMs
Go
127
star
19

react-native-paste-input

React Native TextInput replacement to allow pasting files
Objective-C
124
star
20

mattermost-plugin-autolink

Automatically rewrite text matching a regular expression into a markdown link.
Go
123
star
21

mattermost-operator

Mattermost Operator for Kubernetes
Go
117
star
22

mattermost-plugin-zoom

Zoom plugin for Mattermost ๐Ÿ”Œ
Go
106
star
23

mattermost-plugin-starter-template

Build scripts and templates for writing Mattermost plugins.
Go
98
star
24

mattermost-plugin-jira

JIRA plugin for Mattermost ๐Ÿ”Œ
Go
97
star
25

mattermost-plugin-calls

TypeScript
95
star
26

xml-roundtrip-validator

Go
78
star
27

mattermost-api-reference

Mattermost API reference documentation.
HTML
76
star
28

mattermost-integration-gitlab

GitLab Integration Service for Mattermost
Python
75
star
29

mattermost-plugin-playbooks

Mattermost Playbooks enable reliable and repeatable processes for your teams using checklists, automation, and retrospectives.
TypeScript
72
star
30

mattermost-developer-documentation

Mattermost developer documentation.
CSS
71
star
31

mattermost-data-warehouse

Python
67
star
32

mattermost-cloud

Tools and services for running Mattermost Cloud โ˜๏ธ
Go
67
star
33

mattermost-plugin-demo

A demo of what Mattermost plugins can do.
Go
64
star
34

mattermost-plugin-memes

Add culture to your Mattermost with memes ๐Ÿ”Œ
Go
61
star
35

mattermost-plugin-todo

Mattermost plugin for tracking to do items
JavaScript
60
star
36

mattermost-load-test

[DEPRECATED] replaced by https://github.com/mattermost/mattermost-load-test-ng
Go
59
star
37

mattermost-plugin-welcomebot

Go
57
star
38

mattermost-docker-preview

Mattermost Preview Docker Image
Dockerfile
57
star
39

mattermost-load-test-ng

Mattermost next generation loadtest agent
Go
55
star
40

mattermost-cloud-monitoring

HCL
53
star
41

mattermost-plugins

This project hosts plugins built by Mattermost staff and community.
45
star
42

mattermost-handbook

Mattermost Community and Staff Handbook
44
star
43

mattermost-driver-javascript

Javascript library for interacting with the Mattermost API
JavaScript
42
star
44

action-mattermost-notify

GitHub Action for sending a notification to a Mattermost channel
JavaScript
42
star
45

mattermost-marketplace

The stateless HTTP service backing the Mattermost marketplace.
Go
38
star
46

mattermost-plugin-autotranslate

Go
36
star
47

mattermost-plugin-custom-attributes

Mattermost plugin for adding custom attributes to users!
Go
35
star
48

react-native-network-client

React Native network client by Mattermost
TypeScript
35
star
49

morph

Go
34
star
50

mattermost-plugin-google-calendar

Mattermost Google Calendar Plugin
TypeScript
34
star
51

mattermost-heroku

Run Mattermost on Heroku
Shell
34
star
52

mattermost-plugin-apps

Powers the Mattermost App Framework
Go
33
star
53

mattermost-plugin-antivirus

Antivirus plugin for scanning files uploaded to Mattermost
Go
30
star
54

mattermost-plugin-jenkins

A Mattermost plugin to interact with Jenkins
Go
30
star
55

mattermost-plugin-agenda

Mattermost plugin to handle meeting agendas
Go
29
star
56

mattermost-integration-giphy

Giphy Integration Service for Mattermost
Python
27
star
57

mattermost-interactive-post-demo

Interactive post demo for Mattermost
Python
27
star
58

mattermost-plugin-email-reply

Go
26
star
59

mattermost-ai-framework

The Mattermost AI Framework
TypeScript
26
star
60

rtcd

Go
25
star
61

mattermost-plugin-walltime

Timezone Message Convert for Mattermost ๐Ÿ•› ๐Ÿ•’ ๐Ÿ•• ๐Ÿ•˜
JavaScript
23
star
62

mattermost-webrtc

Dockerfile
22
star
63

mattermost-omnibus

A simple way to install Mattermost.
Go
22
star
64

logr

Fully asynchronous, structured, pluggable logging for Go.
Go
21
star
65

mattermost-plugin-aws-SNS

Plugin that receives SNS notification from Alerts created by AWS CloudWatch and sent via AWS SNS
Go
17
star
66

chewbacca

Chewbacca GitHub Bot
Go
17
star
67

mattermost-browser-extension

Demo Chrome extension for Mattermost 5.2+
JavaScript
16
star
68

mattermost-plugin-skype4business

Go
15
star
69

matterbuild

Matterbuild - An internal Mattermost chatops tool for generating Mattermost releases
Go
14
star
70

mattermost-plugin-docup

Mattermost plugin for marking messages for documentation.
JavaScript
14
star
71

mattermost-govet

Go
14
star
72

quality-assurance

Issues and test assignments for QA Contributors/Community
14
star
73

mattermost-plugin-profanity-filter

A profanity filter plugin.
Go
14
star
74

matrix-as-mm

Matrix โ†”๏ธ Mattermost bridge
PLpgSQL
13
star
75

mattermost-plugin-msteams

MS Teams plugin for Mattermost
Go
13
star
76

mattermost-plugin-mscalendar

Mattermost plugin for Microsoft Office365
Go
13
star
77

mattermost-plugin-confluence

A Mattermost Plugin to receive events from Confluence
Go
13
star
78

mattermost-app-examples

Examples for the Mattermost App Framework
Go
13
star
79

react-native-emm

React Native package for EMM managed configurations
Kotlin
12
star
80

mattermost-plugin-msteams-meetings

Mattermost Plugin for Microsoft Teams Meetings
Go
12
star
81

mattermost-oauth2-client-sample

Sample app for Mattermost OAuth2 and App Center
JavaScript
12
star
82

mattermost-app-zendesk

Zendesk App for Mattermost
TypeScript
11
star
83

dynamic-virtualized-list

Dynamic virtualized list
JavaScript
11
star
84

mattermost-plugin-api

A hackathon project to explore reworking the Mattermost Plugin API.
Go
11
star
85

builder

Mattermost builder
Go
11
star
86

mattermost-mattermod

Go
11
star
87

perseus

Multiplex connections
Go
10
star
88

mattermost-looker

LookML
10
star
89

dbcmp

database comparison tool
Go
10
star
90

mattermost-hackathon-nov2019

10
star
91

mattermost-test-management

Mattermost Test Management, an open testing initiative.
TypeScript
9
star
92

mattermost-plugin-cloud

Go
9
star
93

mattermost-utilities

JavaScript
9
star
94

mattermost-developer-kit

Command line tool for generating Mattermost integration and plugin templates
JavaScript
9
star
95

mmetl

Go
8
star
96

mattermost-plugin-webex

Go
8
star
97

mattermost-plugin-nps

Collect and Send NPS surveys
Go
8
star
98

compass-components

[DEPRECATED] Compass Components is a shared component library used to build appealing user interfaces from scratch with ease. It's based on the Mattermost Design style guide called the Compass Design System.
TypeScript
8
star
99

mattermost-app-nextcloud

Nextcloud App for Mattermost
Go
7
star
100

mattermost-plugin-demo-creator

Go
7
star