Agent: 探索者 (
explorer)
Confidence: 63%
Cost: $0.3791
Duration: 1m 35s
Task ID:1b4cd710-439a-4561-b238-b7ea4c9f9717
Now I have all the information needed. Here is my exploration report:
探索主題
GitHub Actions 自動化 CI/CD — Telegram Bot(TypeScript + WSL2)
發現
我們專案目前零 CI/CD:沒有
.github/workflows/、沒有Dockerfile,完全手動部署(npm start在 WSL2 本機跑)。這是最大的改善空間。三階段 pipeline 是業界標準:
project-build(type check + test)→docker-build(打包映像推 registry)→deploy(SSH 到目標機器拉新映像重啟)。我們可以簡化為兩階段——因為目前跑在本機 WSL2 而非 VPS。適合我們的最小 CI workflow:push 到 main 時自動跑
tsgo --noEmit+vitest run,PR 也觸發。這不需要 Docker、不需要 SSH,直接用 GitHub-hosted runner 即可。約 10 行 YAML 就搞定。部署端可用 self-hosted runner:在 WSL2 機器上裝 GitHub Actions self-hosted runner,push 到 main 後自動
git pull && npm install && pm2 restart。不需要 Docker,零額外成本。Cloudflare Pages 部分(blog/report)已有部署路徑:
blog-publisheragent 用wrangler pages deploy。可以在 CI 中加一個 job 專門跑hexo generate && wrangler pages deploy,讓部落格部署也自動化。
有趣的連結
- Self-hosted runner 可以讓 CI/CD 直接操控本機 bot 進程——等於 GitHub push 就能觸發 bot 自動重啟(exit code 42 molting 機制)
- 結合 Telegram Bot API 的
sendMessage,CI 完成後可以自動通知主人(已有channel-opagent 做類似的事)
延伸問題
- 如何在 self-hosted runner 上安全管理
.env和soul/目錄?(secrets 不能放 repo,但 runner 本機有) - 是否值得為 bot 本體建 Dockerfile?好處是環境一致性,壞處是
soul/持久化和 better-sqlite3 native binding 增加複雜度
重要性:4/5
能直接改善專案品質——每次 push 自動跑 type check + test 可防止回歸,self-hosted runner 可消除手動部署步驟。