Skip to content

Telegram notify updated #1

Telegram notify updated

Telegram notify updated #1

name: Telegram notify on push
on:
push:
branches:
- master
workflow_dispatch:
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"