AstrBot 插件,用于接收 GitHub 事件(push、issues、pull requests 等)并转发到聊天平台(QQ 群组、私聊等)。
- ✅ 接收 GitHub Webhook 事件
- ✅ 支持 Push 事件(代码提交)
- ✅ 支持 Issues 事件(问题追踪)
- ✅ 支持 Pull Request 事件(代码合并)
- ✅ 实时转发到指定的聊天平台群组/用户
- ✅ 自定义端口号配置
- ✅ 简洁的消息格式,包含关键信息
- ✅ Webhook Secret 签名验证(防止恶意请求)
- ✅ 请求速率限制(防止消息轰炸)
- ✅ 全面的错误处理和日志记录
- ✅ LLM 智能消息生成(支持自定义提示词)
- 🔜 自定义消息模板
- 🔜 Release 事件支持
cd AstrBot/data/plugins
git clone https://github.com/TatsukiMengChen/astrbot_plugin_github_webhook.git
cd astrbot_plugin_github_webhook
pip install -r requirements.txt在 AstrBot WebUI 中配置插件,或编辑配置文件:
data/config/astrbot_plugin_github_webhook_config.json
{
"port": 8080,
"target_umo": "platform_id:GroupMessage:群号",
"webhook_secret": "your_github_webhook_secret",
"rate_limit": 10,
"enable_agent": true,
"llm_provider_id": "",
"agent_timeout": 60,
"agent_system_prompt": ""
}sudo systemctl restart astrbot
# 或手动重启 AstrBot查看日志确认插件已加载:
[INFO] GitHub Webhook server started on port 8080
- 进入 GitHub 仓库 → Settings → Webhooks → Add webhook
- Payload URL:
http://你的服务器IP:8080/webhook - Content type:
application/json - Secret (可选): 配置 Webhook 密钥用于签名验证
- Events: 选择需要触发的事件(建议勾选 Pushes, Issues, Pull requests)
- Active: ✅ 勾选
- 点击 "Add webhook"
详细的配置、使用和部署文档请查看 docs/ 目录:
- 文档索引 - 文档导航中心
- 安装指南 - 详细安装步骤
- 配置说明 - 所有配置项详解
- 使用示例 - 查看各种事件的消息格式
- 部署指南 - 防火墙、Docker 部署
- 故障排查 - 常见问题解决方案
- 项目结构 - 代码组织和设计理念
- 开发相关 - 贡献指南和路线图
在 templates/ 目录中提供了预置的系统提示词:
- 默认 Prompt - 通用 GitHub 事件消息生成提示词
astrbot_plugin_github_webhook/
├── src/ # Python 源代码
│ ├── core/ # 核心管理
│ ├── handlers/ # 事件处理
│ ├── formatters/ # 消息格式化
│ ├── utils/ # 工具函数
│ └── services/ # 业务服务
├── main.py # 插件入口
├── metadata.yaml # 插件元数据
├── _conf_schema.json # 配置 Schema
├── docs/ # 详细文档
├── templates/ # Prompt 模板
├── tests/ # 测试代码
├── LICENSE # MIT 许可证
└── README.md # 本文件
详见 项目结构文档
- aiohttp ≥ 3.11.0 - 异步 HTTP 服务器
- Issues 事件支持
- Pull Request 事件支持
- Release 事件支持
- Webhook Secret 签名验证
- 请求速率限制
- 自定义消息模板(Jinja2)
- Agent 集成(智能消息生成)
- 分支过滤(仅监听 main 分支)
- 多目标支持(不同事件发到不同群组)
欢迎提交 Issue 和 Pull Request!详见 开发文档。
本项目采用 MIT 许可证 - 详见 LICENSE 文件
TatsukiMengChen
- AstrBot - 强大的聊天机器人框架
- GitHub Webhooks - GitHub 官方文档