feat(ci): add email notification script and git hook template
Some checks failed
Deploy RIT Freshers Hub to VPS / Deploy to Live VPS (push) Has been cancelled

This commit is contained in:
Shanmuga Krishnan S M
2026-08-07 11:12:34 +05:30
parent 55d31a9ca3
commit d0d49a96a0
2 changed files with 108 additions and 0 deletions

25
scripts/post-receive.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/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