-
Notifications
You must be signed in to change notification settings - Fork 978
35 lines (30 loc) · 1.22 KB
/
discussion-notify.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: Discussion Notifier
on:
discussion:
types: [created]
jobs:
discussion:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Get Info
run: |
sudo apt-get install jq -y &> /dev/null
echo "DIS_TITLE=$(jq --raw-output .discussion.title ${GITHUB_EVENT_PATH})" >> ${GITHUB_ENV}
echo "DIS_URL=$(jq --raw-output .discussion.html_url ${GITHUB_EVENT_PATH})" >> ${GITHUB_ENV}
- name: Notify in Telegram
run: |
TgNotify() {
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TG_BOT_TOKEN }}/sendMessage" -d chat_id="${{ secrets.TG_CHAT_ID }}" \
-d parse_mode=Markdown \
-d text="${1}" \
-d disable_web_page_preview=true
}
TgNotify "
#DISCUSSION
*New Discussion Started at* [${{ github.repository }}](https://github.com/${{ github.repository }})
*Title:* \`${DIS_TITLE}\`
*User:* [${{ github.actor }}](https://github.com/${{ github.actor }})
*Discussion URL:* [Here](${DIS_URL})" &> /dev/null