docs/maintainers/SETUP_GUIDE.zh-CN.md
本指南将帮助你为 NOFX 设置和激活完整的 PR 管理系统。
PR 管理系统包括:
CONTRIBUTING.md - 贡献者指南docs/maintainers/PR_REVIEW_GUIDE.md - 审核者指南docs/maintainers/PROJECT_MANAGEMENT.md - 项目管理工作流程docs/maintainers/SETUP_GUIDE.md - 本文件.github/PULL_REQUEST_TEMPLATE.md - PR 模板(已存在).github/labels.yml - 标签定义.github/labeler.yml - 自动标签规则.github/workflows/pr-checks.yml - 自动化 PR 检查创建 .github/labels.yml 中定义的标签:
# 选项 1:使用 gh CLI(推荐)
gh label list # 查看当前标签
gh label delete <label-name> # 如需要,删除旧标签
gh label create "priority: critical" --color "d73a4a" --description "Critical priority"
# ... 为 labels.yml 中的所有标签重复
# 选项 2:使用 GitHub Labeler Action(自动化)
# 工作流将在推送时自动同步标签
或使用 GitHub Labeler Action(添加到 .github/workflows/sync-labels.yml):
name: Sync Labels
on:
push:
branches: [main, dev]
paths:
- '.github/labels.yml'
jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crazy-max/ghaction-github-labeler@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
对于 main 分支:
mainBackend Tests (Go)Frontend Tests (React/TypeScript)Security Scan对于 dev 分支:
前往 Projects → New project
创建 "NOFX Development" 看板
Backlog、Triaged、In Progress、In Review、Done创建 "Bounty Program" 看板
Available、Claimed、In Progress、Under Review、Paid模板已存在于 .github/ISSUE_TEMPLATE/ 中。验证它们是否正常工作:
如果没有显示,检查文件是否为正确格式的 YAML 和 frontmatter。
创建 .github/CODEOWNERS:
# 全局所有者
* @tinkle @zack
# 前端
/web/ @frontend-lead
# 交易所集成
/internal/exchange/ @exchange-lead
# AI 组件
/internal/ai/ @ai-lead
# 文档
/docs/ @tinkle @zack
*.md @tinkle @zack
对于维护者:
前往 Settings → Notifications
启用:
设置电子邮件过滤器来组织通知
对于仓库:
设置后,验证:
bounty 标签的悬赏 issue# 创建测试分支
git checkout -b test/pr-system-check
# 进行小改动
echo "# Test" >> TEST.md
# 提交并推送
git add TEST.md
git commit -m "test: verify PR automation system"
git push origin test/pr-system-check
# 在 GitHub 上创建 PR
# 验证:
# - PR 模板加载
# - 应用了自动标签
# - CI 检查运行
# - 添加了大小标签
创建改动不同区域文件的 PR:
# 测试 1:前端变更
git checkout -b test/frontend-label
touch web/src/test.tsx
git add . && git commit -m "test: frontend labeling"
git push origin test/frontend-label
# 应该得到 "area: frontend" 标签
# 测试 2:后端变更
git checkout -b test/backend-label
touch internal/test.go
git add . && git commit -m "test: backend labeling"
git push origin test/backend-label
# 应该得到 "area: backend" 标签
解决方案:
# 首先删除所有现有标签
gh label list --json name --jq '.[].name' | xargs -I {} gh label delete "{}" --yes
# 然后从 labels.yml 手动创建或通过 action 创建
检查:
.github/workflows/ 中调试:
# 本地验证工作流
act pull_request # 使用 'act' 工具
检查:
临时修复:
检查:
.github/labeler.yml 存在且为有效 YAMLpull-requests: write 权限每周检查这些指标:
# 使用 gh CLI
gh pr list --state all --json number,createdAt,closedAt
gh issue list --state all --json number,createdAt,closedAt
# 或使用 GitHub Insights
# Repository → Insights → Pulse, Contributors, Traffic
PR 管理系统现在已准备好:
✅ 用清晰的指南引导贡献者 ✅ 自动化重复任务 ✅ 保持代码质量 ✅ 系统性地跟踪进度 ✅ 扩展社区
有问题? 在维护者频道联系我们或开启讨论。
让我们构建令人惊叹的社区!🚀