Giter Club home page Giter Club logo

gitlab-mr-slack's Introduction

GitLab-MR-Slack

Reacts for GitLab Merge Request messages in Slack.


WARNING: This application is currently in beta stage. Breaking changes and unexpected errors may happen.


Usage

First, you have to obtain a Slack API token. This can be done by creating and installing a slack application in the desired workspace. Now you should assign the OAuth scopes detailed below, in order to get an app token.

Once you are running this application, you have to configure GitLab to send webhooks from Merge Request and Comments events. The URL should be like this: base.domain/webhook/channel-id/<channel_id>

Now when somebody sends in a Merge Request URL, and GitLab notifies this application about an event, it will get a reaction automatically.

Required Bot OAuth scopes (SlackAPI)

  • channels:history - View messages in public channels (where the integration is added).
  • groups:history - View messages in private channels (where the integration is added).
  • reactions:read - Add reaction to messages.
  • reactions:write - Remove reaction from messages.

Environment variables

Name Description Default Required
SLACK_APP_TOKEN The Slack application token to use - yes
GITLAB_WEBHOOK_TOKEN GitLab webhook token to accept None no
REACTION_COMMENTS Name of the reaction to use when MR gets comment speech_balloon no
REACTION_APPROVED Name of the reaction to use when MR gets approved white_check_mark no
REACTION_MERGED Name of the reaction to use when MR gets merged leftwards_arrow_with_hook no

Run

Running in Docker

docker run -d -p 8080:8080 -e SLACK_APP_TOKEN="*****" registry.mbraptor.tech/public/gitlab-mr-slack:latest

Run as AWS Lambda function

UNTESTED! But you will need to zip the gitlabmrslack folder, upload it to S3, install the requirements, use API Gateway, and specify the correct lambda handler function.

Run locally

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn gitlabmrslack.app:app

Build

Docker container

docker build -t gitlab-mr-slack .

Testing

:'(

gitlab-mr-slack's People

Contributors

msbence avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.