先说结论
开源项目最怕什么?Issue 提了没人回,用户流失,社区冷清。
BrowserWing 最近加了一套 GitHub 自动化:
- 新 Issue 自动回复:识别首次贡献者,区分 bug/feature
- Issue 模板引导:结构化提交,减少无效沟通
- 智能提示:告诉用户先查 beta 版本,可能问题已解决
效果:用户提 Issue 后 几秒钟内 就收到针对性回复,体验大幅提升。
为什么需要自动化回复
做过开源项目的都知道,Issue 管理是个体力活:
痛点 1:响应慢 用户提完 Issue,可能要等几天才有人回复。很多人等不及就走了。
痛点 2:信息不全 用户只说「不好使」,没给版本号、环境信息。来回问好几轮才能定位问题。
痛点 3:重复劳动 每个 Issue 都要手动写欢迎语、引导补充信息。贡献者的时间被消耗在低价值重复上。
自动化能解决这些问题。
BrowserWing 的自动化方案
1. GitHub Actions 自动回复
工作流配置 .github/workflows/issue-auto-reply.yml:
ini
name: Issue Auto Reply
on:
issues:
types: [opened]
jobs:
greet:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Greet new issue
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const author = issue.user.login;
const labels = issue.labels.map(l => l.name);
const title = issue.title.toLowerCase();
// 检查是否是首次提 issue
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
creator: author,
state: 'all'
});
const isFirstIssue = issues.length === 1;
// 判断 issue 类型
const isBug = labels.includes('bug') || title.includes('[bug]');
const isFeature = labels.includes('enhancement') || title.includes('[feature]');
let lines = [];
if (isFirstIssue) {
lines.push(`👋 Hi @${author}, welcome! Thanks for your first issue!`);
} else {
lines.push(`👋 Thanks @${author} for the feedback!`);
}
lines.push('');
if (isBug) {
lines.push(
`To help us investigate faster, please include:`,
`- BrowserWing version`,
`- OS & environment`,
`- Steps to reproduce`,
`- Logs or error messages`,
``,
`> Try the latest beta release first --- your issue may already be fixed.`
);
} else if (isFeature) {
lines.push(
`We appreciate the suggestion! PRs are welcome if you'd like to contribute.`
);
}
lines.push(`⏱ We typically respond within 1-2 business days.`);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: lines.join('\n')
});
2. Issue 模板
创建 .github/ISSUE_TEMPLATE/bug_report.yml:
less
name: Bug Report
description: Report a bug in BrowserWing
labels: [bug]
body:
- type: textarea
id: description
attributes:
label: Bug Description
placeholder: A clear description of the bug
validations:
required: true
- type: input
id: version
attributes:
label: BrowserWing Version
placeholder: e.g. v1.0.1-beta.2
validations:
required: true
- type: dropdown
id: os
attributes:
label: Operating System
options:
- macOS
- Linux
- Windows
- Docker
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs or Error Messages
placeholder: Paste relevant logs here
同样创建 feature_request.yml 用于功能建议。
3. 配置文件
.github/ISSUE_TEMPLATE/config.yml 控制模板行为:
ruby
blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/browserwing/browserwing/discussions
about: For general questions and discussions
效果展示
用户打开 Bug Report 模板,看到结构化表单:
ini
Bug Description: [必填]
BrowserWing Version: [必填]
Operating System: [下拉选择]
Logs or Error Messages: [可选]
提交后几秒内自动收到回复:
👋 Hi @user, welcome! Thanks for your first issue!
To help us investigate faster, please include:
BrowserWing version
OS & environment
Steps to reproduce
Logs or error messages
Try the latest beta release first --- your issue may already be fixed.
⏱ We typically respond within 1-2 business days.
首次贡献者 会看到特别的欢迎语,Bug 会收到调查引导,Feature 会收到贡献鼓励。
实现细节
首次贡献者识别
核心代码:
php
const { data: issues } = await github.rest.issues.listForRepo({
creator: author,
state: 'all'
});
const isFirstIssue = issues.length === 1;
查询该用户在项目中提交的所有 Issue(包括已关闭),如果只有 1 个,就是首次贡献。
类型判断
两种方式:
- 检查 labels:
bug或enhancement - 检查标题:
[bug]或[feature]
ini
const isBug = labels.includes('bug') || title.includes('[bug]');
const isFeature = labels.includes('enhancement') || title.includes('[feature]');
权限配置
注意 permissions: issues: write 是必需的,否则无法创建评论。
为什么不用第三方 Bot
有现成的工具如 first-issue-bot,但我们选择自己写:
原因 1:完全自定义 可以根据项目特点定制回复内容,比如提示用户先查 beta 版本。
原因 2:无外部依赖 不需要注册第三方服务,代码都在仓库里。
原因 3:学习成本低 GitHub Actions 是 GitHub 原生功能,开发者一看就懂。
其他项目的类似实践
| 项目 | 自动化方式 | 特点 |
|---|---|---|
| VS Code | Issue Bot | 自动分类、分配 owner |
| Electron | Stale Bot | 自动关闭长期未响应 Issue |
| Vue.js | First Timer Bot | 首次贡献者特别欢迎 |
BrowserWing 的方案更轻量,适合中小型开源项目。
快速部署到你的项目
Step 1:创建工作流文件
bash
mkdir -p .github/workflows
touch .github/workflows/issue-auto-reply.yml
复制上面的 YAML 配置,根据你的项目修改回复内容。
Step 2:创建 Issue 模板
bash
mkdir -p .github/ISSUE_TEMPLATE
touch .github/ISSUE_TEMPLATE/bug_report.yml
touch .github/ISSUE_TEMPLATE/feature_request.yml
touch .github/ISSUE_TEMPLATE/config.yml
Step 3:推送并测试
推送后,提一个测试 Issue 验证效果。
下一步改进方向
BrowserWing 计划加入:
- 自动标签建议:根据 Issue 内容推荐标签
- 智能路由:根据模块自动 assign reviewer
- FAQ 检索:回复中附上相关 FAQ 链接
总结
开源项目的「温度」很重要。自动化回复不是敷衍,而是让用户感受到:
「你的反馈被看到了,我们会认真处理。」
几秒钟的自动回复,换来用户的信任和耐心。
GitHub: browserwing/browserwing
有问题评论区聊。