-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (31 loc) · 1.19 KB
/
notificaion.yml
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
name: " Notification"
on:
issues:
types: [opened, reopened]
pull_request_target:
types: [opened, reopened]
jobs:
meme:
name: Generate Message And Send To Telegram
runs-on: ubuntu-latest
steps:
- name: Generate message
run: |
ISSUE_TITLE="${{ github.event.issue.title }}"
ISSUE_BODY="${{ github.event.issue.body }}"
ISSUE_URL="${{ github.event.issue.html_url }}"
ISSUE_AUTHOR="${{ github.event.issue.user.login }}"
MESSAGE="🆕 New Issue Created!\n\n*Title*: $ISSUE_TITLE\n*Description*: $ISSUE_BODY\n*Author*: $ISSUE_AUTHOR\n[View Issue]($ISSUE_URL)"
echo "$MESSAGE" > message.txt
- name: Send Message to Telegram
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT_ID: ${{ vars.TELEGRAM_CHAT_ID }}
TELEGRAM_TOPIC_ID: ${{ vars.TELEGRAM_TOPIC_ID }}
run: |
MESSAGE=$(cat message.txt)
curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" \
-d reply_to_message_id=$TELEGRAM_TOPIC_ID \
-d chat_id=$TELEGRAM_CHAT_ID \
-d text="$MESSAGE" \
-d parse_mode="Markdown"