{"id":18498376,"url":"https://github.com/softdevteam/mattermost-github-integration","last_synced_at":"2025-04-09T00:31:15.520Z","repository":{"id":3695543,"uuid":"49957759","full_name":"softdevteam/mattermost-github-integration","owner":"softdevteam","description":"GitHub integration for Mattermost","archived":false,"fork":false,"pushed_at":"2023-11-08T10:45:11.000Z","size":133,"stargazers_count":83,"open_issues_count":5,"forks_count":50,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-23T19:44:53.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softdevteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-19T14:24:18.000Z","updated_at":"2025-03-05T08:49:25.000Z","dependencies_parsed_at":"2024-11-06T18:16:28.702Z","dependency_job_id":null,"html_url":"https://github.com/softdevteam/mattermost-github-integration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softdevteam%2Fmattermost-github-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softdevteam%2Fmattermost-github-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softdevteam%2Fmattermost-github-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softdevteam%2Fmattermost-github-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softdevteam","download_url":"https://codeload.github.com/softdevteam/mattermost-github-integration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949850,"owners_count":21023402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T13:39:19.133Z","updated_at":"2025-04-09T00:31:12.055Z","avatar_url":"https://github.com/softdevteam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github integration for Mattermost\n\nInspired by [mattermost-integration-gitlab](https://github.com/NotSqrt/mattermost-integration-gitlab) this program creates a server using [flask](https://github.com/mitsuhiko/flask) that listens for incoming GitHub event webhooks. These are then processed, formatted, and eventually forwarded to Mattermost where they are displayed inside a specified channel.\n![](docs/preview.png)\n\n## Requirements\n### System requirements\n- Python3 or Python2\n\n### Application requirements\n\n- Flask (install with `pip install flask`)\n- requests (install with `pip install requests`)\n- (optional) PIL (install with `pip install pillow`) - needed to hide big Github avatars\n\nAll requirements can also be installed using the command\n\n`pip install -r requirements.txt`\n\n## Installation and usage\n\n1. Clone the repository\n2. Within the `mattermostgithub` directory, copy `config.template` to `config.py` and edit it with your details. For example:\n\n```python\nUSERNAME = \"Github\"\nICON_URL = \"yourdomain.org/github.png\"\nMATTERMOST_WEBHOOK_URLS = {\n    'default' : (\"yourdomain.org/hooks/hookid\", \"off-topic\"),\n    'teamname/repositoryname' : (\"yourdomain.org/hooks/hookid2\", \"repository-channel-id\"),\n    'teamname' : (\"yourdomain.org/hooks/hookid3\", \"town-square\"),\n    'teamname/unimportantrepo' : None,\n}\nGITHUB_IGNORE_ACTIONS = {\n    \"issues\": [\"labeled\", \"assigned\"],\n}\nSECRET = 'secretkey'\nSHOW_AVATARS = True\nSERVER = {\n    'hook': \"/\"\n,   'address': \"0.0.0.0\"\n,   'port': 5000\n}\n```\n\nTest the server with `python server.py`. For deployment, please consider using\nWSGI (more details\n[here](https://flask.palletsprojects.com/en/1.0.x/deploying/wsgi-standalone/)).\nFor example to run using Gunicorn, execute:\n```\ngunicorn -b 0.0.0.0:5000 mattermostgithub:app\n```\n\nAlternatively, a `Dockerfile` is provided to run using Docker (see below).\n\n### Webhooks\nGitHub messages can be delegated to different Mattermost hooks. The order is as\nfollows:\n- First try to find a hook for the repositories full name.\n- If that fails, try to find a hook for the organisation name.\n- Otherwise use the default hook.\n\nRepositories can be blacklisted by setting them to `None` instead of\n`(url, channel)`.\n\n### Ignore actions\nSpecific Github events can be ignored by adding `GITHUB_IGNORE_ACTIONS` to `config.py`. In the example above `labeled` and `assigned` events for\nissues are ignored, while `opened`, `closed`, etc. events will continue to show\nup on Mattermost.\n\n### Server settings\nThe server is listening by default on address `0.0.0.0`, port `5000`, and\nusing `/` as base route.\nMake sure to point your Github webhooks to `http://yourdomain.org:5000/`.\n\nIf you have a proxy/load-balancer in front of your machine, and do not want to\nexpose port 5000 to the outside, change the `SERVER['hook']` value and redirect it\nto this service.\nFor example, if `SERVER['hook']` is `/hooks/github`, your Github webhooks\nwould be `http://yourdomain.org/hooks/github`.\n\n### Secret\nThe secret key that can be set when setting up the Github webhook. If you don't want to use a secret, set the field to `None`.\n\n## Deploying with Docker\n\nTo deploy with Docker, make sure you have Docker installed and run:\n\n```\ndocker build --rm=true -t mm-github .\ndocker run --rm -v \"$(pwd)\":/home/app -w /home/app -p 5000:5000 -ti mm-github\n```\n\nIf you want to run in background mode, change the option `--rm` for `-d`.\n\n## Supported Events\n\nNot all Github events are forwarded to Mattermost. Currently supported events are:\n\n* Ping events (send when first adding the Github webhook)\n* Commit pushes and comments\n* Issues (open, close, comment)\n* Pull Requests (create, merge, remove, comment)\n* Create/Delete repositories\n* Create/Delete branches and tags\n\nAll other events will report back to GitHub with `400 Not Implemented`.\n\n## Known issues\n\n- Channel names need to use the spelling that is used in their URL (the channel ID), e.g. instead\nof `Town Square` it needs to be `town-square`.\n\n- If you set a custom username (as shown in the default config), make sure you also set **Enable webhooks and slash commands to override usernames** under **Custom Integrations** in the System Console to **True**. Otherwise the bots username will be that of the person that setup the Mattermost integration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftdevteam%2Fmattermost-github-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftdevteam%2Fmattermost-github-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftdevteam%2Fmattermost-github-integration/lists"}