A simple python bot that serves to send some notifications about GitHub events to Slack.

Overview

github alerts slack bot 🤖

What is it? 🔍

This is a simple bot that serves to send some notifications about GitHub events to Slack channels.

These are the features currently developed:

  • notification to inform Pull Requests with conflicts

Others features may be developed in the future.


How it works 🧑‍🏭

  • GitHub webhook send a request to bot to selected event (Pull Request has been opened, per example)
  • It handle the request
    • it check if the request comes from the correct GitHub webhook to avoid fraud
    • it don't send repeated notification with same data on the same day
  • Whether yes, the Slack webhook is called to create a message in on channel with the information (a Pull Request is open)

Configuration ⚙️

Create a access token of GitHub

Navigate to Settings > Developer Settings > Personal access tokens > Generate new token

The permission repo is only need to access necessary datas of yours repositories: image

Save the access token after creating it.

Create a workflow in Slack

The workflow is the point used to send the notifications and here there are a tutorial to create one.

The only var required in the text is prs_list.

You can customize the message of your workflow as you wish:

example of workflow

After create, save the workflow webhook.

Deploy the bot

First, create your fork of this project to can perform the deploy.

The our bot is configured to deploy in Heroku. Heroku is a cloud platform to deploy your simple projects, they have a free plan that will be enough for us. You can also choose another cloud platform to do this.

Create a new app > Select the deploy on GitHub > Choose your fork of this project

Greate! If everything is ok, you can see this message:

success deploy

Install Redis

Redis is used to check if one message is send in the past day with the same pull requests.

In the dashboard of your project in Heroku, go to Resources > Find more add-ons

Select Redis Enterprise Cloud. It will probably ask you to set up the credit card on your account, but don't worry, the free plan is enough to our bot. After set up your credit card, select the free plan and the project of bot to install the Redis.

It is listed in your add-ons if everything is ok:

redis add-on

Access the add-on and complete the Redis url with the datas: http://rediscloud:[email protected]:port

Like this: http://rediscloud:cofe6kWpNnsdlfkçlç[email protected]:1234

This will be used to connect our bot with the Redis.

Create GitHub webhook

Your repository to track > Settings > Webhooks > add webhook

In the Payload URL, past the URL of your Heroku project and the endpoint check_conflicts. Like this: https://my-heroku-app.herokuapp.com/check_conflicts

The Content type is application/json.

I recommend using a UUID in the Secret. This will ensure the security of the requests. Save this secret to use in virtual environments of the project

In the events, select Let me select individual events. and select Pull requests in the list of events.

Now just save.

Setting envs

Finally, the last step is set the virtual environments in the Heroku project.

Heroku project > Settings > Reveal Config vars.

Now set this envs:

  • SECRET_ACCESS: secret used in GitHub webhook
  • ACCESS_TOKEN: your access token of GitHub
  • PROJECT_TO_TRACK: project of the GitHub webhook. Example: jackson541/github-alerts-slack-bot
  • BRANCH_TO_TRACK: the branch of the project that you want to track. Example: master
  • SLACK_WEBHOOK_LINK: the URL of the workflow created in Slack
  • REDIS_URL: the URL created with the datas of Redis. example: http://rediscloud:cofe6kWpNnsdlfkçlç[email protected]:1234

You can stop and have your coffee, everything is set up!


Contribute

Contribute is always well received! Feel free to open Pull Requests or Issues. 😄

Owner
Jackson Alves
Formação de Técnico em informática pelo IFRN e atualmente cursando Ciência e Tecnologia na UFRN.
Jackson Alves
An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. This is Also The Source Code of The Bot Which is Being Used In @SafoTheBot Group! ❤️

Telegram Video Player Bot (Beta) An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. Special Features Supports Live Streaming From

SAF ONE 206 Jan 03, 2023
SelfBot, a lots of features: Mass DM , Nuke, Raid... and more!

SelfBot, a lots of features: Mass DM , Nuke, Raid... and more!

eryycr 2 Nov 10, 2021
Latest Open Source Code for Playing Music in Telegram Video Chat. Made with Pyrogram and Pytgcalls 💖

MusicPlayer_TG Latest Open Source Code for Playing Music in Telegram Video Chat. Made with Pyrogram and Pytgcalls 💖 Requirements 📝 FFmpeg NodeJS nod

Abhijith Sudhakaran 2 Feb 04, 2022
Share your files on local network just by one click.

Share Your Folder This script helps you to share any folder anywhere on your local network. it's possible to use the script on both: Windows (Click he

Mehran Seifalinia 15 Oct 23, 2022
Rock API is an API that allows you to view rocks and find the ratings on them

Rock API The best Rock API What is Rock API? Rock API is an API that allows you to view rocks and find the ratings on them. However, this isn't a regu

Conos 21 Sep 21, 2022
Report-snapchat - Report Snapchat acc with python

report-snapchat Report Snapchat acc Report users on Snapchat about the tool : 4

17 Dec 01, 2022
RedFish API Toolkit

RedFish API Toolkit RedFish API Toolkit Build Status GitHub Actions Travis CI Requirements requirements.txt requirements-dev.txt Dependencies Document

Larry Smith Jr. 1 Nov 20, 2021
Skautský discord bot

Jáchym 🤖 Open-source skautský discord bot postavený na discord.py O čem? • Funkce • TODO • Poděkování ❓ O čem? Jáchym vznikl jako projekt do odborky

10 May 12, 2022
DadBot 2.0 is an interactive bot that reflects the personality of a typical dad

DadBot 2.0 is an interactive bot that reflects the personality of a typical dad! You can start by running main while all directories are maintained as they are on this GitHub.

1 Dec 04, 2021
A multi purpose discord bot for python

Sypher The best multi purpose discord bot. Add Sypher right now Invite Me | Join

Johan Naizu 1 Dec 15, 2022
Advance Anonymous Sender bot with Caption Editor

AnonyMous Sender 👨‍💻 Advanced Anonymous Sender with Caption Editor Join @DaisySupport_Official 🎵 for help Features Get forwarded messages without f

Inuka Asith 13 Oct 09, 2022
Wrapper for vk_api lib for faster bot buliding

Welcome to VKBotPod repository! Wrapper for vk_api lib for faster bot buliding Features Simple syntax Rich functionality Special thanks to movpushmov

NullPointerException 3 Jan 14, 2022
Send SMS text messages via email with as many accounts as you want :)

SMS-Spammer Send SMS text messages via email with as many accounts as you want :) Example Set Up Guide! To start log into the gmail account you would

Riceblades11 10 Oct 25, 2022
Please Do Not Throw Sausage Pizza Away - Side Scrolling Up The OSI Stack

Please Do Not Throw Sausage Pizza Away - Side Scrolling Up The OSI Stack

John Capobianco 2 Jan 25, 2022
GitPython is a python library used to interact with Git repositories.

Gitoxide: A peek into the future… I started working on GitPython in 2009, back in the days when Python was 'my thing' and I had great plans with it. O

3.8k Jan 03, 2023
Rust UserBot, Telegram istifadəsini asanlaşdıran bir proyektdir.

RUST USERBOT 🇦🇿 Rust UserBot, Telegram istifadəsini asanlaşdıran bir proyektdir. Qurulum Heroku Serverə qurulum git clone https://github.com/rustres

1 Oct 25, 2021
Terraform module to ship CloudTrail logs stored in a S3 bucket into a Kinesis stream for further processing and real-time analysis.

AWS infrastructure to ship CloudTrail logs from S3 to Kinesis This repository contains a Terraform module to ship CloudTrail logs stored in a S3 bucke

Nexthink 8 Sep 20, 2022
A multipurpose Telegram Bot written in Python for mirroring files on the Internet to Google Drive

Mirror Leech Bot Mirror Leech Bot is a multipurpose Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive. Ba

1 Jan 01, 2022
A python script that automatically farms the Discord bot 'Dank Memer'.

Dank Farmer A python script that automatically farms the Discord bot 'Dank Memer'. Requirements pynput Disclaimer DO NOT use if you are not willing to

2 Dec 30, 2021
Music cog for discord bots. Supports YouTube, YoutubeMusic, SoundCloud and Spotify.

dismusic Music cog for discord bots. Supports YouTube, YoutubeMusic, SoundCloud and Spotify. Installation python3 -m pip install dismusic Usage from d

Md Shahriyar Alam 59 Jan 08, 2023