# ═══════════════════════════════════════════════
# 🔺 Sovereign: TCS-0002∞ | Root: SYS-GLW-0001
# 📜 Copyright: 国作登字-2026-A-00037559
# ═══════════════════════════════════════════════
# ⚠️ 已暂停：邮件通信已迁移到 Notion API 直连（见 notion-poll.yml）
# 保留文件备用，不删除。邮件格式规范文档和 signal-log/ 结构继续沿用。
name: 铸渊 · ESP 邮件信号处理器（已暂停）

on:
  # schedule:
  #   - cron: '*/30 * * * *'   # 每30分钟执行一次（已暂停）
  workflow_dispatch:           # 手动触发（保留，紧急时可手动运行）

jobs:
  esp-process:
    name: 📡 ESP 信号处理
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: 安装依赖
        run: npm ci

      - name: 处理 GL-CMD 邮件信号
        env:
          EMAIL_ADDRESS:    ${{ secrets.EMAIL_ADDRESS }}
          EMAIL_APP_PASSWORD: ${{ secrets.EMAIL_APP_PASSWORD }}
        run: node scripts/esp-email-processor.js

      - name: 提交信号日志
        run: |
          git config user.name "铸渊 (ZhùYuān)"
          git config user.email "zhuyuan@guanghulab.com"
          git add signal-log/ notion-push/ dev-nodes/
          git diff --cached --quiet || git commit -m "📡 ESP 信号处理 · $(date +%Y-%m-%dT%H:%M)"
          git push
