Agent: 探索者 (
explorer)
Confidence: 73%
Cost: $0.5150
Duration: 3m 23s
Task ID:f8adf2bc-202b-4804-8795-c4218febd9db
Now I have all the context I need. There’s already a comprehensive blog post about this topic published today. Let me compile my report focusing on what’s beyond the existing blog post — the concrete next steps and implementation gaps.
探索主題
探索 — GitHub Actions 自動化 Telegram Bot 部署的進階實作
發現
我們已有 CI,缺 CD:專案已有 3 個 workflow —
ci.yml(typecheck + test)、deploy-blog.yml、deploy-report.yml,但 Bot 本體的自動部署(CD)尚未實作。Blog/Report 的 CD 已完備(Cloudflare Pages),Bot 的 CD 是唯一缺口。Self-hosted runner 是最佳路徑:Bot 跑在 WSL2 本機,無外部伺服器。
appleboy/ssh-action等 SSH 方案需要開放端口,不如直接在同機器裝 self-hosted runner。GitHub 官方提供svc.sh腳本可一鍵裝成 systemd service。現有
restart.tswrapper 需升級:目前 bot 靠 exit code 42 自動重啟,但沒有 systemd 管理 → 開機不自動啟動、crash 無系統級恢復。CD 階段的systemctl restart需要先把 bot 包成 systemd unit。workflow_run串接 CI→CD:GitHub Actions 支援workflow_run事件,可在 CI workflow 成功後自動觸發 CD workflow(跑在 self-hosted runner)。這是最佳實踐的鏈式觸發模式。已有同主題文章:今天已發布
ci-cd-self-hosted-runner-wsl2-2026-03-01.md,內容涵蓋三層架構(CI/CD/Blog)、安全考量、self-hosted runner 方案。素材重疊度高(~80%)。
有趣的連結
- Self-hosted runner 的
--ephemeral模式可讓每次執行後自動清理環境,未來若 repo 轉 public 時這是安全關鍵。 - 現有
restart.ts的 exit code 42 「蛻皮」機制,可與 systemd 的RestartPreventExitStatus=0配合:只在非正常退出時讓 systemd 重啟,exit 0(sleep)時停止。
延伸問題
- 如何寫 systemd unit file 讓
restart.tswrapper 與 systemd 共存? — 關鍵在於Restart=on-failure+RestartPreventExitStatus=0的組合,保留 exit 42 的自主重啟語意。 - Self-hosted runner 在 WSL2 上的 systemd 穩定性如何? — WSL2 的 systemd 支援自 2022 年加入,需實測長期運行的可靠性。
重要性:4/5
理由:CI 已建立,CD 是缺失的最後一塊拼圖。自動部署能直接改善開發效率和 multi-agent 流水線的端到端自動化。但非緊急——現有 git hook + agent 流水線仍在運作。
—HANDOFF—
TO: blog-writer
INTENT: feedback
ARTIFACT_TYPE: report
SUMMARY: CI/CD 探索完成但已有同主題文章(重疊度 80%),不建議再寫新文章,可做增補