所有文章
OpenClaw GitHub 自動化:Issues、PR、CI/CD 與 Code Review

OpenClaw GitHub 自動化:Issues、PR、CI/CD 與 Code Review

|3 分鐘閱讀

OpenClaw 直接連接 GitHub API,將你的 AI agent 變成一個 GitHub 自動化工具——分類 issues、審查 PR、監控 CI 和管理 releases,全部透過 Telegram 或自然語言控制。

設定

第一步:安裝 GitHub Plugin

openclaw plugins install @anthropic/mcp-github

第二步:建立 GitHub Token

前往 GitHub Settings > Developer settings > Personal access tokens > Fine-grained tokens,建立具有以下權限的 token:

  • Repository access:選擇你的 repos
  • Permissions:Issues(讀/寫)、Pull requests(讀/寫)、Actions(讀)、Contents(讀)

第三步:設定

openclaw config set mcpServers.github.env.GITHUB_TOKEN "ghp_your_token_here"
openclaw restart

第四步:測試

傳送訊息給你的 OpenClaw bot:

"List open issues on my-org/my-repo"

Issue 自動化

自動分類新 Issues

"Watch my-org/my-repo for new issues. When one is created:
 1. Read the issue body
 2. Add appropriate labels (bug, feature, question, docs)
 3. If it's a bug, add priority label based on severity
 4. Send me a Telegram summary"

過期 Issue 清理

"Every week, find issues in my-org/my-repo with no activity
 for 30 days. Post a comment asking if the issue is still
 relevant. If no response after 7 more days, close it."

Issue 通知轉 Telegram

"When a new issue is opened with the 'urgent' label,
 immediately send me a Telegram alert with the title,
 author, and a summary of the issue body."

Pull Request 工作流程

PR Review 摘要

"When a PR is opened on my-org/my-repo, read the diff
 and send me a Telegram summary with:
 - What changed (2-3 sentences)
 - Files modified count
 - Potential concerns or breaking changes
 - Direct link to the PR"

自動標記 PR

"When a PR is opened, add labels based on the files changed:
 - Changes to /src/api/ → 'backend'
 - Changes to /src/components/ → 'frontend'
 - Changes to /tests/ → 'tests'
 - Changes to /*.md → 'docs'"

PR 大小警告

"If a PR has more than 500 lines changed, post a comment
 suggesting it be split into smaller PRs. Be polite."

CI/CD 監控

建置失敗警報

"Monitor GitHub Actions on my-org/my-repo. When a workflow
 fails on the main branch:
 1. Fetch the error logs
 2. Summarize the failure reason
 3. Send me a Telegram alert with the summary and link"

部署追蹤

"When the 'deploy' workflow completes successfully on main,
 send me a Telegram message: 'Deployed to production:
 [commit message] by [author]'"

Workflow 執行時間追蹤

"Track how long CI runs take on my-org/my-repo. Every
 Friday, tell me the average build time this week and
 flag any that took over 10 minutes."

Release 管理

自動產生 Release Notes

"When I say 'release v1.2.3', create a GitHub release:
 1. List all PRs merged since the last release
 2. Group them by label (features, fixes, docs)
 3. Generate a changelog
 4. Create the release with the changelog"

版本更新提醒

"When 10 PRs have been merged since the last release,
 remind me that it might be time for a new release."

多 Repo 工作流程

跨 Repo 狀態

"Every morning, give me a status update across all my
 repos: open PRs awaiting my review, failed CI builds,
 and issues assigned to me."

組織儀表板

"List all repos in my-org with open PRs older than 7 days.
 For each, show the PR title, author, and days open."

安全性與存取權限

最小 Token 範圍

只授予你的工作流程需要的權限。對於唯讀監控:

  • Issues:讀
  • Pull requests:讀
  • Actions:讀
  • Contents:讀

只有在你希望 OpenClaw 建立 issues、在 PR 上留言或管理 releases 時,才加入寫入權限。

Token 輪替

定期更換你的 GitHub token:

# 更新 token
openclaw config set mcpServers.github.env.GITHUB_TOKEN "ghp_new_token"
openclaw restart

開始使用

ClawTank 部署,安裝 GitHub plugin,你的 AI 驅動 GitHub 自動化就能在幾分鐘內上線。監控 CI、分類 issues、審查 PR——全部在 Telegram 上完成。

準備好部署 OpenClaw 了嗎?

不需要 Docker、SSH、DevOps。不到 1 分鐘即可部署。

免費開始使用