-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtg_gh_star.sh
44 lines (30 loc) · 1.17 KB
/
tg_gh_star.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
39
40
41
42
43
44
#!/bin/sh
# Get the token from Travis environment vars and build the bot URL:
BOT_URL="https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage"
# Set formatting for the message. Can be either "Markdown" or "HTML"
PARSE_MODE="Markdown"
status=$INPUT_STATUS
# Define send message function. parse_mode can be changed to
# HTML, depending on how you want to format your message:
send_msg () {
curl -s -X POST ${BOT_URL} -d chat_id=$TELEGRAM_CHAT_ID \
-d text="$1" -d parse_mode=${PARSE_MODE}
}
# Send message to the bot with some pertinent details about the job
# Note that for Markdown, you need to escape any backtick (inline-code)
# characters, since they're reserved in bash
send_msg "
⭐️⭐️⭐️
*${GITHUB_ACTOR}* starred ${GITHUB_REPOSITORY}
ID: ${GITHUB_WORKFLOW}
Action was a *${status}!*
\`Repository: ${GITHUB_REPOSITORY}\`
On: *${GITHUB_EVENT_NAME}*
By: *${GITHUB_ACTOR}*
No of Stars: ${STARGAZERS}
}
[Link to Repo ]("https://github.com/${GITHUB_REPOSITORY}/")
[Link to ${GITHUB_ACTOR}'s Profile]("https://github.com/${GITHUB_ACTOR}/")
[Build log here]("https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}/checks")
-----
"