From 8f2065315b35ccd28c0425cf472b7fe781f39841 Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Wed, 24 Jun 2026 23:22:07 +0800 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d6324128..7152a4d0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -497,36 +497,37 @@ jobs: steps: - name: Send Telegram failure notification - if: secrets.TELEGRAM_BOT_TOKEN && secrets.TELEGRAM_CHAT_ID + if: ${{ secrets.TELEGRAM_BOT_TOKEN != '' && secrets.TELEGRAM_CHAT_ID != '' }} env: TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} run: | MESSAGE="❌ **部署失败** -📦 项目: ${{ github.repository }} -🌿 分支: ${{ github.ref_name }} -🔗 Commit: ${{ github.sha }} -🕐 时间: $(date +'%Y-%m-%d %H:%M:%S') + 📦 项目: ${{ github.repository }} + 🌿 分支: ${{ github.ref_name }} + 🔗 Commit: ${{ github.sha }} + 🕐 时间: $(date +'%Y-%m-%d %H:%M:%S') + + 📝 工作流: ${{ github.workflow }} + 🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" -📝 工作流: ${{ github.workflow }} -🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \ -d chat_id="${TELEGRAM_CHAT_ID}" \ -d text="${MESSAGE}" \ -d parse_mode="Markdown" - name: Send Feishu failure notification - if: secrets.FEISHU_WEBHOOK_URL + if: ${{ secrets.FEISHU_WEBHOOK_URL != '' }} env: FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} run: | + CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S') curl -s -X POST "${FEISHU_WEBHOOK_URL}" \ -H "Content-Type: application/json" \ -d '{ "msg_type": "text", "content": { - "text": "❌ **部署失败**\n\n📦 项目: ${{ github.repository }}\n🌿 分支: ${{ github.ref_name }}\n🔗 Commit: ${{ github.sha }}\n🕐 时间: '$(date +'%Y-%m-%d %H:%M:%S')'\n\n📝 工作流: ${{ github.workflow }}\n🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + "text": "❌ **部署失败**\n\n📦 项目: ${{ github.repository }}\n🌿 分支: ${{ github.ref_name }}\n🔗 Commit: ${{ github.sha }}\n🕐 时间: '"${CURRENT_TIME}"'\n\n📝 工作流: ${{ github.workflow }}\n🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" } }' \ No newline at end of file