forked from Gitlink/gitlink-cli
207 lines
6.3 KiB
Markdown
207 lines
6.3 KiB
Markdown
# Workflow: Community Ops(社区运营自动化)
|
||
|
||
> **前置条件:** 先阅读 [`../../gitlink-shared/SKILL.md`](../../../gitlink-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
||
> **AI Agent 工作流**:此工作流专为 AI Agent 设计,用于自动化社区运营。
|
||
|
||
AI Agent 自动完成社区运营任务,包括 Issue 分类、负责人分配、周报生成、Release Notes 发布。
|
||
|
||
## 工作流概述
|
||
|
||
Community Ops 工作流自动化社区运营的四个核心环节:Issue 分析 → 负责人分配 → 周报生成 → Release Notes 发布。
|
||
|
||
## 适用场景
|
||
|
||
- **Issue 管理**:自动分类和分配新 Issue
|
||
- **周报生成**:汇总本周数据生成社区周报
|
||
- **发版管理**:生成 Release Notes 并发布
|
||
- **定期运营**:每周/每月定期执行社区运营
|
||
|
||
## 触发词
|
||
|
||
- "社区运营" / "community ops"
|
||
- "周报" / "weekly report"
|
||
- "发版" / "release notes"
|
||
- "Issue 分类" / "issue triage"
|
||
|
||
## 参数
|
||
|
||
| 参数 | 必填 | 说明 |
|
||
|------|------|------|
|
||
| `--owner` | 否 | 仓库所有者(自动从 git remote 解析) |
|
||
| `--repo` | 否 | 仓库名称(自动从 git remote 解析) |
|
||
| `--weeks-ago` | 否 | 生成 N 周前的周报(默认 0 = 本周) |
|
||
| `--dry-run` | 否 | 预览模式,不执行写入操作 |
|
||
|
||
## 工作流步骤
|
||
|
||
### 阶段 1:Issue 自动分类
|
||
|
||
**步骤 1.1** — 获取 open issues:
|
||
|
||
```bash
|
||
gitlink-cli issue +list --owner {OWNER} --repo {REPO} --state open --limit 100 --format json
|
||
```
|
||
|
||
**步骤 1.2** — 分类规则:
|
||
|
||
| 类型 | 标签 | 关键词 |
|
||
|------|------|--------|
|
||
| Bug | `bug` | bug, error, crash, fault, fix |
|
||
| Feature | `feature` | feature, enhancement, add, support, request |
|
||
| Question | `question` | how, question, help |
|
||
| Docs | `documentation` | doc, readme, guide, tutorial, example |
|
||
|
||
**步骤 1.3** — 添加标签:
|
||
|
||
```bash
|
||
gitlink-cli issue +label-add --owner {OWNER} --repo {REPO} --number {ISSUE_ID} --labels {LABEL}
|
||
```
|
||
|
||
### 阶段 2:负责人分配(基于贡献度 AHP 评分)
|
||
|
||
**引用 [`workflow-contributor-growth.md`](workflow-contributor-growth.md) 的 AHP 评分模型**
|
||
|
||
负责人分配基于贡献者的 AHP 评分,优先分配给贡献度高的成员。
|
||
|
||
**步骤 2.1** — 收集数据:
|
||
|
||
```bash
|
||
# 获取仓库成员
|
||
gitlink-cli repo +members --owner {OWNER} --repo {REPO} --limit 50 --format json
|
||
|
||
# 获取 merged PR(统计贡献)
|
||
gitlink-cli pr +list --owner {OWNER} --repo {REPO} --state merged --limit 100 --format json
|
||
|
||
# 获取 closed Issues(统计参与)
|
||
gitlink-cli issue +list --owner {OWNER} --repo {REPO} --state closed --limit 100 --format json
|
||
```
|
||
|
||
**步骤 2.2** — 计算每个成员的 AHP 分数:
|
||
|
||
| 维度 | 权重 | 计算方式 |
|
||
|------|------|----------|
|
||
| Issues Created | 15% | 该成员创建的 Issue 数 / 最大值 |
|
||
| PRs Merged | 25% | 该成员合并的 PR 数 / 最大值 |
|
||
| Code Changes | 30% | 该成员代码变更行数 / 最大值 |
|
||
| Issue Comments | 15% | 该成员评论数 / 最大值 |
|
||
| Team Member | 15% | 是成员=1,非成员=0 |
|
||
|
||
```
|
||
Score = NI×15 + NM×25 + NL×30 + NC×15 + MS×15
|
||
```
|
||
|
||
**步骤 2.3** — 筛选待分配 Issue 并分配:
|
||
|
||
```bash
|
||
# 只分配 Bug 和 Feature 类型的 Issue
|
||
# Bug → 标签含 "bug"/"缺陷"
|
||
# Feature → 标签含 "feature"/"功能"
|
||
|
||
# 按分数从高到低排序成员
|
||
# Bug:优先分配给最高分成员(确保快速解决)
|
||
# Feature:按分数轮流分配(鼓励参与)
|
||
|
||
# 分配命令
|
||
gitlink-cli issue +batch-assign --owner {OWNER} --repo {REPO} --numbers {ISSUE_NUMBERS} --assignee {LOGIN}
|
||
```
|
||
|
||
**分配策略**:
|
||
- Bug 类型:优先分配给贡献度最高的成员(快速响应)
|
||
- Feature 类型:按贡献度轮流分配(鼓励更多人参与)
|
||
- 成员不足时用 Round-robin 补充
|
||
|
||
### 阶段 3:周报生成
|
||
|
||
**步骤 3.1** — 收集数据:
|
||
|
||
```bash
|
||
# Closed issues
|
||
gitlink-cli issue +list --owner {OWNER} --repo {REPO} --state closed --limit 100 --format json
|
||
|
||
# Merged PRs
|
||
gitlink-cli pr +list --owner {OWNER} --repo {REPO} --state merged --limit 100 --format json
|
||
```
|
||
|
||
**步骤 3.2** — 周报模板:
|
||
|
||
```markdown
|
||
# Community Weekly Report: {WEEK_START} ~ {WEEK_END}
|
||
|
||
## Summary
|
||
- New Issues: **{NEW_COUNT}**
|
||
- Closed Issues: **{CLOSED_COUNT}**
|
||
- Merged PRs: **{MERGED_COUNT}**
|
||
|
||
## Issue Classification
|
||
| Type | Count |
|
||
|------|-------|
|
||
| Bug | {BUG_COUNT} |
|
||
| Feature | {FEATURE_COUNT} |
|
||
| Question | {QUESTION_COUNT} |
|
||
| Docs | {DOCS_COUNT} |
|
||
|
||
## Highlights
|
||
- Auto-classified and labeled {TOTAL_CLASSIFIED} issues
|
||
- Assigned responsible persons for bug and feature issues
|
||
|
||
---
|
||
*Auto-generated by gitlink-cli community-ops workflow*
|
||
```
|
||
|
||
**步骤 3.3** — 发布到 Wiki:
|
||
|
||
```bash
|
||
gitlink-cli wiki +create --owner {OWNER} --repo {REPO} --title "{REPORT_TITLE}" --content "{REPORT_BODY}"
|
||
```
|
||
|
||
### 阶段 4:Release Notes 生成
|
||
|
||
**引用 [`../workflow-release-notes.md`](workflow-release-notes.md)**
|
||
|
||
Release Notes 的生成遵循 Release Notes 工作流的规范:
|
||
|
||
1. **收集数据**:获取 commits、merged PR、closed Issue
|
||
2. **分类整理**:按类型归类(新功能/Bug修复/改进/破坏性变更)
|
||
3. **生成发布**:套用模板生成 Notes,创建 Release
|
||
|
||
**快捷命令**:
|
||
|
||
```bash
|
||
gitlink-cli release +create --tag {TAG} --name "{NAME}" --body "{NOTES}"
|
||
```
|
||
|
||
## 完整流程图
|
||
|
||
```
|
||
Issue 分类 → 负责人分配 → 周报生成 → Release Notes
|
||
↓ ↓ ↓ ↓
|
||
添加标签 API PATCH Wiki 发布 Release 创建
|
||
```
|
||
|
||
## 使用示例
|
||
|
||
### AI 交互式
|
||
|
||
用户说:"帮我跑一下社区运营"
|
||
|
||
AI 应该:
|
||
1. 确认 owner/repo(自动从 git remote 解析或询问用户)
|
||
2. 依次执行四个阶段
|
||
3. 展示每阶段的结果
|
||
4. 询问是否需要调整
|
||
|
||
## 注意事项
|
||
|
||
- Issue 分类基于关键词匹配,可能不准确,建议人工审核
|
||
- 负责人分配只针对 Bug 和 Feature 类型
|
||
- 周报数据基于时间范围筛选,不是所有 open issues
|
||
- Release Notes 生成引用 changelog 工作流的规范
|
||
|
||
## References
|
||
|
||
- [workflow-release-notes](workflow-release-notes.md) — Release Notes 生成
|
||
- [workflow-issue-triage](workflow-issue-triage.md) — Issue 分类详情
|
||
- [gitlink-issue](../../gitlink-issue/SKILL.md) — Issue 操作
|
||
- [gitlink-wiki](../../gitlink-wiki/SKILL.md) — Wiki 操作
|
||
- [gitlink-release](../../gitlink-release/SKILL.md) — Release 操作
|