forked from OWASP/SecureTea-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.teleNotify.sh
39 lines (27 loc) · 844 Bytes
/
.teleNotify.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# Get the token
BOT_URL="https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage"
# Set formatting
PARSE_MODE="Markdown"
# Check if all previous steps passed:
if [ $TRAVIS_TEST_RESULT -ne 0 ]; then
build_status=" ❌ Failed 👎"
else
build_status=" ✅ Succeeded 👍"
fi
# Send message function
send_msg () {
curl -s -X POST ${BOT_URL} -d chat_id=$TELEGRAM_CHAT_ID \
-d text="$1" -d parse_mode=${PARSE_MODE}
}
# Call send message with the message
send_msg "
\`----------------------------------------------------------------\`
Build *${build_status}!*
\`Repository 📦: ${TRAVIS_REPO_SLUG}\`
\`Branch 🏷: ${TRAVIS_BRANCH}\`
*Commit Msg 💭:*
_${TRAVIS_COMMIT_MESSAGE}_
[Job Log view here 👉](${TRAVIS_JOB_WEB_URL})
\`----------------------------------------------------------------\`
"