-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (26 loc) · 1.17 KB
/
telegram_notify.yml
File metadata and controls
32 lines (26 loc) · 1.17 KB
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
name: Telegram notify on push
on:
push:
branches:
- main
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send message to Telegram
run: |
FULL_MSG="${{ github.event.head_commit.message }}"
HEADER=$(echo "$FULL_MSG" | head -n 1)
DESC=$(echo "$FULL_MSG" | tail -n +2 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -z "$DESC" ]; then DESC="No description provided"; fi
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_MONITOR_TOKEN }}/sendMessage" \
-d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
-d parse_mode="HTML" \
-d disable_web_page_preview="true" \
-d text="User <a href='https://github.com/${{ github.actor }}'>${{ github.actor }}</a> committed into <b>${{ github.repository }}</b>
<b>Commit header:</b> $HEADER
<b>Commit description:</b> <i>$DESC</i>
<a href='https://github.com/${{ github.repository }}'>Link to repository</a>
<a href='${{ github.event.head_commit.url }}'>Link to commit</a>
<a href='https://github.com/${{ github.actor }}'>Link to user profile</a>
#log"