Files
RIT-nexus/scripts/post-receive.sh
Shanmuga Krishnan S M d0d49a96a0
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled
feat(ci): add email notification script and git hook template
2026-08-07 11:12:34 +05:30

26 lines
812 B
Bash

#!/bin/bash
# Configuration (or set in environment variables on VPS)
export SENDER_EMAIL="your-gmail-id@gmail.com"
export SENDER_PASSWORD="your-16-digit-app-password"
export RECIPIENT_EMAIL="your-recipient-email@gmail.com"
while read oldrev newrev refname
do
BRANCH=$(echo $refname | cut -d/ -f3)
COMMIT_HASH=$(git log -1 --format="%h" $newrev)
AUTHOR=$(git log -1 --format="%an <%ae>" $newrev)
MESSAGE=$(git log -1 --format="%B" $newrev)
TIMESTAMP=$(git log -1 --format="%cd" --date=local $newrev)
CHANGED_FILES=$(git diff-tree --no-commit-id --name-status -r $newrev | head -n 15)
python3 /var/www/freshers-hub/scripts/send_git_email.py \
"$BRANCH" \
"$AUTHOR" \
"$COMMIT_HASH" \
"$TIMESTAMP" \
"$MESSAGE" \
"$CHANGED_FILES"
done