Skip to content

GollaBharath/Git-Notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔔 Git-Notify

A lightweight webhook relay service that sits between GitHub / Gitea and Discord.

When someone pushes code, Git-Notify pings your Discord channel with @everyone so the team knows to pull.

GitHub/Gitea  ──push webhook──▶  Git-Notify  ──rich embed──▶  Discord Channel

Features

  • 📡 Accepts GitHub and Gitea push webhooks
  • 💬 Sends rich Discord embeds with @everyone ping
  • 🔐 HMAC-SHA256 signature verification (optional)
  • 🔄 Retry logic with Discord rate-limit awareness
  • 🪶 Zero database — fully stateless
  • 🚀 ~50 lines combined handler logic, dead simple to maintain

Quick Start

1. Clone & install

git clone https://github.com/your-org/Git-Notify.git
cd Git-Notify
npm install

2. Configure

cp .env.example .env

Edit .env:

PORT=3000
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN
WEBHOOK_SECRET=your-optional-shared-secret

3. Run

# Development (auto-restarts on changes, Node 18+)
npm run dev

# Production
npm start

Creating the Discord Webhook

  1. Open your Discord server
  2. Go to Channel Settings → Integrations → Webhooks
  3. Click New Webhook
  4. Name it (e.g., "Git-Notify") and choose the target channel
  5. Copy the Webhook URL → paste it into your .env as DISCORD_WEBHOOK_URL

Configuring GitHub Webhooks

  1. Go to your repo → Settings → Webhooks → Add webhook
  2. Set:
    • Payload URL: http://your-server:3000/webhook/github
    • Content type: application/json
    • Secret: same value as WEBHOOK_SECRET in your .env (leave blank if not using)
    • Events: select Just the push event
  3. Save — GitHub will send a ping event and you should see 🏓 GitHub ping received in the logs

Configuring Gitea Webhooks

  1. Go to your repo → Settings → Webhooks → Add Webhook → Gitea
  2. Set:
    • Target URL: http://localhost:3000/webhook/gitea (since Git-Notify runs on the same machine)
    • HTTP Method: POST
    • POST Content Type: application/json
    • Secret: same value as WEBHOOK_SECRET in your .env
    • Trigger On: Push Events
    • Active: ✅
  3. Save & test with the Test Delivery button

Deploying as a systemd Service

Perfect for running alongside your Gitea instance on a closed-network machine:

# Copy files to /opt
sudo cp -r . /opt/git-notify
sudo cp git-notify.service /etc/systemd/system/

# Make sure .env is configured
sudo nano /opt/git-notify/.env

# Enable & start
sudo systemctl daemon-reload
sudo systemctl enable git-notify
sudo systemctl start git-notify

# Check status
sudo systemctl status git-notify
sudo journalctl -u git-notify -f

API Endpoints

Method Path Description
POST /webhook/github Receives GitHub push webhooks
POST /webhook/gitea Receives Gitea push webhooks
GET /health Health check

What the Discord Message Looks Like

@everyone 🚨 Pull your code! New push to org/repo on main by username

🐙 New push to org/repo abc1234 fix: update the readme def5678 feat: add webhook handler

Source: github • Branch: main


Project Structure

Git-Notify/
├── src/
│   ├── server.js          # Express entry point
│   ├── config.js          # Env config loader
│   ├── formatter.js       # Discord embed formatter
│   ├── discord.js         # Discord webhook client
│   └── handlers/
│       ├── github.js      # GitHub webhook handler
│       └── gitea.js       # Gitea webhook handler
├── .env.example           # Config template
├── .gitignore
├── git-notify.service     # systemd unit file
├── package.json
└── README.md

License

MIT

About

This is a discord bot which notifies developers every time someone pushes some code to a repo of their choosing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors