Skip to content

Commit fc9cae9

Browse files
committed
Enhance README and GitHub Actions with Telegram notification setup
- Updated README.md to include instructions for configuring Telegram notifications for daily check-in results. - Modified daily-check-in.yml to conditionally send success and failure notifications via Telegram, ensuring notifications are only sent if the necessary secrets are configured.
1 parent b09c3e4 commit fc9cae9

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/daily-check-in.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,22 @@ jobs:
2929
run: |
3030
python main.py
3131
32-
- name: Send Success Telegram Notification
33-
if: ${{ success() }} # 只有当执行成功时发送通知
32+
- name: Send Telegram Notification
33+
if: ${{ success() && secrets.TELEGRAM_TOKEN != '' && secrets.TELEGRAM_USERID != '' }}
3434
run: |
3535
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage" \
3636
-d chat_id=${{ secrets.TELEGRAM_USERID }} \
37-
-d text="LINUX DO每日签到成功完成"
37+
-d parse_mode=HTML \
38+
-d text="✅ <b>LINUX DO</b> 每日签到成功完成"
3839
39-
- name: Send Failure Telegram Notification
40-
if: ${{ failure() }} # 只有当执行失败时发送失败通知
40+
- name: Send Failure Notification
41+
if: ${{ failure() && secrets.TELEGRAM_TOKEN != '' && secrets.TELEGRAM_USERID != '' }}
4142
run: |
4243
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage" \
4344
-d chat_id=${{ secrets.TELEGRAM_USERID }} \
44-
-d text="LINUX DO每日签到失败,请检查日志!"
45-
45+
-d parse_mode=HTML \
46+
-d text="❌ <b>LINUX DO</b> 每日签到失败"
47+
4648
- name: Delete workflow runs
4749
uses: Mattraks/delete-workflow-runs@v2
4850
with:

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,26 @@
3333

3434
## 运行结果
3535

36+
### 网页中查看
3637
`Actions`栏 -> 点击最新的`Daily Check-in` workflow run -> `run_script` -> `Execute script`
3738

3839
可看到`Connect Info`
3940
(新号可能这里为空,多挂几天就有了)
4041
![image](https://github.com/user-attachments/assets/853549a5-b11d-4d5a-9284-7ad2f8ea698b)
4142

43+
### Telegram 通知
4244

45+
可选功能:配置 Telegram 通知,实时获取签到结果。
46+
47+
需要在 GitHub Secrets 中配置:
48+
- `TELEGRAM_TOKEN`:Telegram Bot Token
49+
- `TELEGRAM_USERID`:Telegram 用户 ID
50+
51+
获取方法:
52+
1. Bot Token:与 [@BotFather](https://t.me/BotFather) 对话创建机器人获取
53+
2. 用户 ID:与 [@userinfobot](https://t.me/userinfobot) 对话获取
54+
55+
未配置时将自动跳过通知功能,不影响签到。
4356

4457
## 自动更新
4558

0 commit comments

Comments
 (0)