fix: 修复TG通知workflow语法错误

- 移除if条件中对secrets的直接引用(GitHub Actions不支持)
- 改用shell脚本内部检查环境变量是否存在
This commit is contained in:
shaw
2025-12-27 16:03:13 +08:00
parent 7af1bdbf4c
commit f133b051dc

View File

@@ -146,12 +146,17 @@ jobs:
# Send Telegram notification # Send Telegram notification
- name: Send Telegram Notification - name: Send Telegram Notification
if: ${{ secrets.TELEGRAM_BOT_TOKEN != '' && secrets.TELEGRAM_CHAT_ID != '' }}
env: env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
continue-on-error: true continue-on-error: true
run: | run: |
# 检查必要的环境变量
if [ -z "$TELEGRAM_BOT_TOKEN" ] || [ -z "$TELEGRAM_CHAT_ID" ]; then
echo "Telegram credentials not configured, skipping notification"
exit 0
fi
TAG_NAME=${GITHUB_REF#refs/tags/} TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v} VERSION=${TAG_NAME#v}
REPO="${{ github.repository }}" REPO="${{ github.repository }}"