-
Notifications
You must be signed in to change notification settings - Fork 10
26 lines (24 loc) · 991 Bytes
/
notify.yml
File metadata and controls
26 lines (24 loc) · 991 Bytes
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
name: Notify Telegram on GitHub Push
description: 'Send notifications to Telegram channel only (groups are notified by Skills script)'
on:
push:
branches:
- main
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Send to channel
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
run: |
if [ -n "$CHANNEL_ID" ]; then
# 生成当前年月的网站页面链接(格式:YYYYMM)
CURRENT_MONTH=$(date +'%Y%m')
WEBSITE_URL="https://doc.869hr.uk/AIknowledge/${CURRENT_MONTH}"
TEXT=$'📦 新增资源推送\n\n${{ github.event.head_commit.message }}\n\n🔗 查看详情:'${WEBSITE_URL}$'\n🌐 资料总站:https://doc.869hr.uk'
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
-d chat_id="$CHANNEL_ID" \
--data-urlencode "text=${TEXT}"
fi