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
Salmanul Farisx Bot With Python

Salman_Farisx_Bot How To Deploy Video Subscribe YouTube Channel Added Features Imdb posters for autofilter. Imdb rating for autofilter. Custom caption

1 Dec 23, 2021
A Python IRC bot with dynamically loadable modules

pybot This is a modular, plugin-based IRC bot written in Python. Plugins can bedynamically loaded and unloaded at runtime. A design goal is the abilli

Jeff Kent 1 Aug 20, 2021
Unofficial API wrapper for seedr.cc

Seedr API Unofficial API wrapper for seedr.cc Inspired by theabbie's seedr-api Powered by @harp_tech (Telegram) How to use You can install lib via git

Anjana Madu 49 Oct 24, 2022
A script that takes what you're listening too on Spotify and sets it as your Nertivia custom status.

nertivia-spotify-listening-status A script that takes what you're listening too on Spotify and sets it as your Nertivia custom status. setup Install r

Ben Tettmar 2 Feb 03, 2022
A simple, lightweight Discord bot running with only 512 MB memory on Heroku

Haruka This used to be a music bot, but people keep using it for NSFW content. Can't everyone be less horny? Bot commands See the built-in help comman

Haruka 4 Dec 26, 2022
🎵 RythmReloaded 🎵 A bot that can play music on Telegram Group and Channel Voice Chats

🎵 RythmReloaded 🎵 A bot that can play music on Telegram Group and Channel Voice Chats POWERED BY MARSHALX TGCALLS Available on telegram as @OptimusP

0 Nov 03, 2021
It was increasingly cumbersome to eye-grep CF output in the AWS console.

cfplot Overview It was increasingly cumbersome to eye-grep CF output in the AWS console. I couldn't find another tool out there to provide individual

46 Dec 26, 2022
Binance Futures Client

Binance Futures Client

4 Aug 02, 2022
A thin Python Wrapper for the Dark Sky (formerly forecast.io) weather API

Dark Sky Wrapper This is a wrapper for the Dark Sky (formerly forecast.io) API. It allows you to get the weather for any location, now, in the past, o

Ze'ev Gilovitz 414 Nov 16, 2022
Discord bot do sprawdzania ceny pizzy.

Discord bot do sprawdzania ceny pizzy w pizzeri Bombola. Umieszczony jest na platformie Heroku, dzięki czemu działa 24/7. Commands List Info: Jako com

1 Sep 18, 2021
This will create new discord accounts and add them to your server

Discord-Botter This tool will create new discord accounts add them to your server, this tool needs a captcha api like capmonster.cloud or anti-captcha

Shahzain 27 Nov 30, 2022
👾 Telegram Smart Group Assistant 🤖

DarkHelper 🌖 Features ⚡️ Smart anti-apam & anti-NFSW message checker Tag Members , Entertain facility , Welcommer ban , unban , mute , unmute , lock

amirali rajabi 38 Dec 18, 2022
Free and Open Source Channel/Group Voice chat music player for telegram ❤️ with button support Heroku Commands

ZeusMusic Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7 or higher PyTgCalls MongoDB 2nd Telegram Account (needed for userbot) 🧪 Get SESSION

ZeusNetwork 4 Jan 03, 2022
A script to find the people whom you follow, but they don't follow you back

insta-non-followers A script to find the people whom you follow, but they don't follow you back Dependencies: python3 libraries - instaloader, getpass

Ritvik 5 Jul 03, 2022
Python script to Funge NFTs.

Python script to Funge NFTs. It scrapes OpenSea for a given list of NFT collections and downloads a certain number of NFTs from each collection or the entire collections.

3 Apr 28, 2022
A Python bot that uses the Reddit API to send users inspiring messages.

AnonBot By Edric Antoine A Python bot that uses the Reddit API to send users inspiring messages. When a message includes 'What would Anon do?', the bo

1 Jan 05, 2022
This an API wrapper library for the OpenSea API written in Python 3.

OpenSea NFT API Python 3 wrapper This an API wrapper library for the OpenSea API written in Python 3. The library provides a simplified interface to f

Attila Tóth 159 Dec 26, 2022
Wechat based auto reply with pyautogui

Python-微信 自动回复 练手~ 一直想做个给微信发个消息,就可以跑Python程序,并将结果发送给我的东西,之前看了 B站@不高兴就喝水 的视频,终于有了灵感~ 使用的是模拟点击方案,请求期间是不能操作了。 库 pyautogui 用于模拟鼠标键盘操作和定位操作位置 pyperclip 剪贴板

Vito Song 1 Oct 22, 2022
A user reconnaisance tool that extracts a target's information from Instagram, DockerHub & Github.

A user reconnaisance tool that extracts a target's information from Instagram, DockerHub & Github. Also searches for matching usernames on Github.

Richard Mwewa 127 Dec 22, 2022
Crystal Orb is a discord bot made from discord.py and python

Crystal orb Replacing barbot Overview Crystal Orb is a discord bot made from discord.py and python, Crystal Orb is for anti alt detection and other st

AlexyDaCoder 3 Nov 28, 2021