关于 setup-github
此技能为代码仓库配置 GitHub 项目看板、标签和 Actions 工作流。它会检测现有设置并跳过已配置项,同时提供可选的审查、部署和维护工作流目录。
主要功能
- 01检测仓库现有配置
- 02创建工作流与类型标签
- 03设置 GitHub 项目看板
- 04安装选定的 Actions 工作流
- 05配置自动 PR 审查流程
- 06幂等跳过已有项目
适用场景
- 01为新仓库准备 GitHub 环境
- 02添加用于跟踪问题和 PR 的标签
- 03安装 CI/CD 或维护工作流
- 04设置自动拉取请求审查
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ fellowship-dev/ dogfooded-skills --skill setup-github安装后在 Claude Code 中输入/setup-github确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
templates/claude-code-review.ymlclaude-issue-triage.ymlclaude-prd-creation.ymldependabot.ymldeploy-ecs-production.ymldeploy-ecs-staging.ymldeploy-fly.ymldeploy-mkdocs.yml详细介绍
GitHub 设置助手
为代码仓库设置完整的 GitHub 环境:项目看板、标签和 Actions 工作流。每个阶段都是幂等的——检测到已有配置时会跳过。
通过 npx 安装:
npx skills add fellowship-dev/dogfooded-skills/skills/ops/setup-github
重要:安装由 Claude 驱动的工作流之前,务必确认已安装 Claude GitHub App(https://github.com/apps/claude)。如果未安装该应用,工作流将因身份验证错误而失败。
适用场景
- 为新代码仓库端到端设置 GitHub 环境
- 添加自动化审查流水线(double-check → cto-review)
- 创建用于跟踪工作流的标准标签
- 安装 CI/CD 工作流
审查流水线
此技能会设置自动化的 3 阶段 PR 审查流水线:
1. PR opened
↓
2. GitHub Actions: claude-code-review.yml
- Claude reviews the diff
- Applies "reviewed" label
↓
3. event-rules.yml: review-pr-on-reviewed
- /double-check PR_NUMBER org/repo dispatched
- Curates CI findings, fixes must-fix items
- Applies "double-checked" label
↓
4. event-rules.yml: cto-review-on-double-checked
- /cto-review PR_NUMBER org/repo dispatched
- Docs/deps/downstream checklist
- Applies "approved" or "needs-work" label
- Merges if approved
第 3–4 阶段所用技能:fellowship-dev/dogfooded-skills 中的 double-check 和 cto-review。
先决条件:Claude GitHub App
使用由 Claude 驱动的工作流之前,请安装 Claude GitHub App:
-
安装:https://github.com/apps/claude — 选择你的代码仓库或组织
-
身份验证(任选一种):
选项 A:通过 Claude CLI 获取 OAuth 令牌(推荐)
unset GH_TOKEN gh auth login claude /install-github-app # Select repo → "long-lived token" → auto-adds CLAUDE_CODE_OAUTH_TOKEN secret选项 B:API 密钥
- 获取密钥:https://console.anthropic.com/settings/keys
- 在此处添加密钥
ANTHROPIC_API_KEY:https://github.com/{owner}/{repo}/settings/secrets/actions
操作说明
1. 检测阶段
分析代码仓库:
# Repo identity
gh repo view --json nameWithOwner
# Existing labels
gh label list --repo $REPO --json name
# Existing workflows
ls .github/workflows/ 2>/dev/null || echo "No workflows"
# Project board
gh project list --owner $ORG --format json 2>/dev/null | head -20
以状态表的形式报告现有配置和缺失配置。
2. 标签阶段
跳过已存在的标签(幂等)。使用 gh label create 创建:
工作流标签(用于 PR 流水线):
| 标签 | 颜色 | 说明 |
|---|---|---|
reviewed | #3da46e | CI/自动化审查已完成 |
double-checked | #0075ca | 完整审查与修复已完成 |
approved | #0e8a16 | CTO 已批准——可以合并 |
needs-work | #d93f0b | 合并前需要处理 |
ready-to-work | #f6a80a | 已准备好实施 |
in-progress | #97f157 | 正在处理中 |
类型标签:
| 标签 | 颜色 | 说明 |
|---|---|---|
bug | #d73a4a | 某些功能无法正常工作 |
enhancement | #54d9ee | 新功能或改进 |
documentation | #0075ca | 仅涉及文档 |
groundwork | #C5DEF5 | 基础设施/工具/重构 |
# Create all labels (idempotent — 2>/dev/null suppresses "already exists" errors)
gh label create "reviewed" --repo $REPO --color "3da46e" --description "CI/automated review complete" 2>/dev/null || true
gh label create "double-checked" --repo $REPO --color "0075ca" --description "Full review + fixes complete" 2>/dev/null || true
gh label create "approved" --repo $REPO --color "0e8a16" --description "CTO approved — ready to merge" 2>/dev/null || true
gh label create "needs-work" --repo $REPO --color "d93f0b" --description "Needs work before merge" 2>/dev/null || true
gh label create "ready-to-work" --repo $REPO --color "f6a80a" --description "Ready for implementation" 2>/dev/null || true
gh label create "in-progress" --repo $REPO --color "97f157" --description "Actively being worked on" 2>/dev/null || true
gh label create "bug" --repo $REPO --color "d73a4a" --description "Something isn't working" 2>/dev/null || true
gh label create "enhancement" --repo $REPO --color "54d9ee" --description "New feature or improvement" 2>/dev/null || true
gh label create "documentation" --repo $REPO --color "0075ca" --description "Documentation only" 2>/dev/null || true
gh label create "groundwork" --repo $REPO --color "C5DEF5" --description "Infra/tooling/refactoring" 2>/dev/null || true
报告:“已创建 N 个标签,跳过 N 个(已存在)。”
3. 项目看板阶段
如果此代码仓库已存在 GitHub Project,则跳过。
# Create project
gh project create --owner $ORG --title "$REPO_NAME"
# Add Status field with standard columns
# (Use GitHub UI to configure Status options — API support is limited)
# Columns: Backlog → Ready → In Progress → In Review → Done
# Link repo to project
gh project link $PROJECT_NUMBER --owner $ORG --repo $REPO
注意:在 GitHub Projects UI 中配置自动移动规则:
- 打开 PR 时,自动移动到“In Review”
- PR 合并或 issue 关闭时,自动移动到“Done”
4. 工作流安装阶段
跳过 .github/workflows/ 中已存在的工作流。
展示可用工作流并等待确认:
AI 驱动的工作流(需要 Claude GitHub App)
- claude-code-review.yml — 自动审查 PR。添加
reviewed标签。推荐——它会触发完整的审查流水线。 - claude-issue-triage.yml — 自动为新 issue 添加标签
- claude-prd-creation.yml — 根据功能请求生成 PRD
部署工作流
- deploy-fly.yml — 部署到 Fly.io
- deploy-ecs-production.yml — 部署到 AWS ECS(生产环境)
- deploy-ecs-staging.yml — 部署到 AWS ECS(预发布环境)
- deploy-mkdocs.yml — 构建文档并部署到 GitHub Pages
维护
- dependabot.yml — 自动更新依赖项(每周)
- sync-api-docs.yml — 将文档同步到单独的代码仓库
确认后,安装所选工作流:
mkdir -p .github/workflows
# Copy selected templates from this skill's templates/ directory
# Skip if file already exists
5. 总结阶段
## GitHub Setup Complete: $REPO
### Labels
- ✅ Created N labels, skipped N (already existed)
### Project Board
- ✅ Created "$REPO_NAME" project (or "Skipped — already exists")
⚠️ Configure automations manually in project settings
### Workflows
- ✅ Installed: claude-code-review.yml
- ⏭️ Skipped: dependabot.yml (already existed)
- ⚠️ Secrets needed: ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN
### Review Pipeline (after claude-code-review.yml is installed)
PR opened → reviewed label → double-check → double-checked label → cto-review → approved/needs-work
### Manual Next Steps
- [ ] Install Claude GitHub App: https://github.com/apps/claude
- [ ] Add ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN secret
- [ ] Configure project board automations (link above)
- [ ] Wire event-rules.yml with review-pr-on-reviewed + cto-review-on-double-checked rules
工作流目录
所有 Claude 工作流都需要 ANTHROPIC_API_KEY 或 CLAUDE_CODE_OAUTH_TOKEN。
| 工作流 | 触发条件 | 输出 | 流水线角色 |
|---|---|---|---|
claude-code-review.yml | PR 打开或重新打开 | 审查评论 + reviewed 标签 | 阶段 1 |
claude-issue-triage.yml | 新建议题 | 标签 + 优先级 | 独立 |
claude-prd-creation.yml | 议题标签或 @claude | PRD 文档 | 独立 |
deploy-fly.yml | 推送到 main | Fly.io 部署 | CD |
deploy-ecs-production.yml | 推送到 main | ECS 部署(生产环境) | CD |
deploy-ecs-staging.yml | 推送到 develop | ECS 部署(预发布环境) | CD |
dependabot.yml | 每周定时任务 | 依赖项更新 PR | 维护 |
必需的密钥
| 密钥 | 位置 | 备注 |
|---|---|---|
ANTHROPIC_API_KEY | https://console.anthropic.com/settings/keys | 推荐。以 sk-ant- 开头 |
CLAUDE_CODE_OAUTH_TOKEN | 运行 claude /install-github-app | API 密钥的替代方案 |
FLY_API_TOKEN | flyctl auth token | 用于 Fly.io 部署 |
AWS_ACCESS_KEY_ID | AWS IAM 控制台 | 用于 ECS 部署 |
AWS_SECRET_ACCESS_KEY | AWS IAM 控制台 | 用于 ECS 部署 |
配套文件
templates/claude-code-review.yml— 通用 Claude PR 审查工作流templates/claude-issue-triage.yml— 议题标记工作流templates/claude-prd-creation.yml— PRD 生成工作流templates/dependabot.yml— Dependabot 配置templates/deploy-fly.yml— Fly.io 部署templates/deploy-ecs-production.yml— AWS ECS 生产环境templates/deploy-ecs-staging.yml— AWS ECS 预发布环境templates/deploy-mkdocs.yml— MkDocs 文档