Sends messages to a Discord webhook whenever you make a new commit to your local git repository.

Overview

Git-Notif

Sends messages to a Discord webhook whenever you make a new commit to your local git repository.

Usage

Just drop notifier.py into your git hooks directory (by default, it's .git/hooks) and rename the file to post-commit. Update post-commit's permissions to allow it to be executable: chmod 755 post-commit.

Optionally, you may use the following installer script to install this script automatically into your git hooks directory:

#!/usr/bin/env bash

CURL_LOC=$(which curl)

if [[ $? -ne 0 ]]; then
    if [[ -z $1 ]]; then
        echo "[ - ] Failed to locate cURL." 1>&2
        echo "[ - ] Make sure cURL is installed and available." 1>&2
        echo "[ - ] Alternatively, you may pass this script a valid location to a cURL binary as it's first argument." 1>&2
        exit 1
    fi

    if [[ $($1 -V | grep -Eo "^curl") != "curl" ]]; then
        echo "[ - ] ${1} is not a valid cURL binary." 1>&2
        exit 1
    fi

    CURL_LOC=$1
fi

if [[ -z $GIT_DIR ]]; then
    GIT_DIR=".git"
fi

# ensure we're inside a git repository.
if [[ $(find . -maxdepth 1 -type d -name $GIT_DIR -printf "%P" | tr -d "\n") != $GIT_DIR ]]; then
    echo "[ - ] No git directory found." 1>&2
    echo "[ - ] Make sure you're inside a git repository." 1>&2
    exit 1
fi

HOOKS_DIR=$(git config core.hooksPath)
if [[ -z $HOOKS_DIR ]]; then
    HOOKS_DIR=$GIT_DIR/hooks
fi

# ensure we have rw perms on the hooks dir.
if [[ ! -r $HOOKS_DIR ]] || [[ ! -w $HOOKS_DIR ]]; then
    echo "[ - ] Unable to access ${HOOKS_DIR}." 1>&2
    exit 1
fi

cd $HOOKS_DIR
$CURL_LOC https://raw.githubusercontent.com/tins2831/git-notif/master/notifier.py --output post-commit

chmod 755 post-commit

echo "[ + ] Installed."

There is a configuration file (.wh_config.json) that's generated at the project level when the tool is first ran. You must edit this file and add your webhook's ID and token:

https://discord.com/api/webhooks/{id}/{token}

Sample

Sample image

You might also like...
Git Plan - a better workflow for git
Git Plan - a better workflow for git

git plan A better workflow for git. Git plan inverts the git workflow so that you can write your commit message first, before you start writing code.

😈  Discord RAGE is a Python tool that allows you to automatically spam messages in Discord
😈 Discord RAGE is a Python tool that allows you to automatically spam messages in Discord

😈 Discord RAGE Python tool that allows you to automatically spam messages in Discord 🏹 Setup Make sure you have Python installed and PIP is added to

Telegram bot that sends new offers from otomoto.pl

Telegram bot that sends new offers under certain filters from otomoto.pl How to use this bot? Install requirements with pip install -r requirements.tx

Bombcrypto-bot - A python bot that automatically logs in, clicks the new button, and sends heroes to work in the bombcrypto game
Discord Bot that can translate your text, count and reply to your messages with a personalised text

Discord Bot that can translate your text, count and reply to your messages with a personalised text

Get Notified about vaccine availability in your location on email & sms βœ‰οΈ! Vaccinator Octocat tracks & sends personalised vaccine info everday. Go get your shot ! πŸ’‰
Get Notified about vaccine availability in your location on email & sms βœ‰οΈ! Vaccinator Octocat tracks & sends personalised vaccine info everday. Go get your shot ! πŸ’‰

Vaccinater Get Notified about vaccine availability in your location on email & sms βœ‰οΈ ! Vaccinator Octocat tracks & sends personalised vaccine info ev

This bot plays the most recent video from the Daily Silksong News Youtube Channel whenever a specific user enters voice chat once a day.

Do you have that one friend that really likes Hollow Knight. Are they waiting for Silksong to come out? Heckle them with this Discord bot.

Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

A Discord bot that rewards players in Minecraft for sending messages on Discord

MCRewards-Discord-Bot A Discord bot that rewards players in Minecraft for sending messages on Discord How to setup: Download this git as a .zip, or cl

Owner
null
This is to notify you via Discord whenever there is a new beacon.

BeaconNotifier-Discord This is to notify you via Discord whenever there is a new beacon. Make sure you have python3 installed Steps: Create a Discord

null 26 Dec 28, 2022
A Discord bot that generates inspirational quotes & motivating messages whenever a user is sad

Encourage bot is a discord bot that allows users to randomly get Inspirational quotes messages and gives motivational encouragements whenever someone says that he's sad/depressed.

null 1 Nov 25, 2021
Tracks twitter spaces and sends it to a discord webhook.

Tracks twitter spaces and sends it to a discord webhook. Uses the twitter api to find twitter spaces and then the m3u8 url for the space is found using selenium and will have it posted using a discord webhook. Optionally It can also download the twitter space after it ends.

Sam Phung 20 Dec 17, 2022
Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel!

YouTube Feeds Bot. Send notification to your telegram group/channel/private whenever a new video is uploaded on a youtube channel! Variables BOT_TOKEN

Aditya 30 Dec 7, 2022
API to retrieve the number of grades on the OGE website (Website listing the grades of students) to know if a new grade is available. If a new grade has been entered, the program sends a notification e-mail with the subject.

OGE-ESIREM-API Introduction API to retrieve the number of grades on the OGE website (Website listing the grades of students) to know if a new grade is

Benjamin Milhet 5 Apr 27, 2022
Automatically pulls specified repository whenever a specified file is pushed. Great for working collaboratively when you need to run something locally.

autopull Simple python tool that allows you to automatically pull from a github repository whenever a file with a specified name is uploaded installat

carreb 0 Sep 27, 2022
A simple discord bot named atticus that sends you the timetable of your classes upon request

A simple discord bot named atticus that sends you the timetable of your classes upon request. Soon, it would you ping you before classes too!

Samhitha 3 Oct 13, 2022
A simple bot that lives in your Telegram group, logging messages to a Postgresql database and serving statistical tables and plots to users as Telegram messages.

telegram-stats-bot Telegram-stats-bot is a simple bot that lives in your Telegram group, logging messages to a Postgresql database and serving statist

null 22 Dec 26, 2022
This project checks the weather in the next 12 hours and sends an SMS to your phone number if it's going to rain to remind you to take your umbrella.

RainAlert-Request-Twilio This project checks the weather in the next 12 hours and sends an SMS to your phone number if it's going to rain to remind yo

null 9 Apr 15, 2022
A project that automatically sends you a Medium article on a topic of your choosing to your email address daily.

Daily Article from Medium ✏️ About A project that automatically sends you a Medium article on a topic of your choosing to your email address daily. No

Orhan Emre Dikicigil 2 Apr 27, 2022