diff --git a/.github/workflows/auto-i18n.yml b/.github/workflows/auto-i18n.yml index d4bf43dc26..541f174d33 100644 --- a/.github/workflows/auto-i18n.yml +++ b/.github/workflows/auto-i18n.yml @@ -90,3 +90,30 @@ jobs: - name: 📢 Notify if no changes if: steps.git_status.outputs.has_changes != 'true' run: echo "Bot script ran, but no changes were detected. No PR created." + + - name: Send failure notification to Feishu + if: always() && (failure() || cancelled()) + shell: bash + env: + FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} + FEISHU_WEBHOOK_SECRET: ${{ secrets.FEISHU_WEBHOOK_SECRET }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + JOB_STATUS: ${{ job.status }} + run: | + # Determine status and color + if [ "$JOB_STATUS" = "cancelled" ]; then + STATUS_TEXT="已取消" + COLOR="orange" + else + STATUS_TEXT="失败" + COLOR="red" + fi + + # Build description using printf + DESCRIPTION=$(printf "**状态:** %s\n\n**工作流:** [查看详情](%s)" "$STATUS_TEXT" "$RUN_URL") + + # Send notification + pnpm tsx scripts/feishu-notify.ts send \ + -t "自动国际化${STATUS_TEXT}" \ + -d "$DESCRIPTION" \ + -c "${COLOR}" diff --git a/.github/workflows/sync-to-gitcode.yml b/.github/workflows/sync-to-gitcode.yml index ae6006ee76..bfc544d405 100644 --- a/.github/workflows/sync-to-gitcode.yml +++ b/.github/workflows/sync-to-gitcode.yml @@ -300,3 +300,31 @@ jobs: run: | rm -f /tmp/release_payload.json /tmp/upload_headers.txt release_body.txt rm -rf release-assets/ + + - name: Send failure notification to Feishu + if: always() && (failure() || cancelled()) + shell: bash + env: + FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} + FEISHU_WEBHOOK_SECRET: ${{ secrets.FEISHU_WEBHOOK_SECRET }} + TAG_NAME: ${{ steps.get-tag.outputs.tag }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + JOB_STATUS: ${{ job.status }} + run: | + # Determine status and color + if [ "$JOB_STATUS" = "cancelled" ]; then + STATUS_TEXT="已取消" + COLOR="orange" + else + STATUS_TEXT="失败" + COLOR="red" + fi + + # Build description using printf + DESCRIPTION=$(printf "**标签:** %s\n\n**状态:** %s\n\n**工作流:** [查看详情](%s)" "$TAG_NAME" "$STATUS_TEXT" "$RUN_URL") + + # Send notification + pnpm tsx scripts/feishu-notify.ts send \ + -t "GitCode 同步${STATUS_TEXT}" \ + -d "$DESCRIPTION" \ + -c "${COLOR}"