setup-github
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub Setup Assistant
GitHub 环境设置助手
Set up a complete GitHub environment for a repository: project board, labels, and Actions workflows. Each phase is idempotent — existing configuration is detected and skipped.
Install via npx:
bash
npx skills add fellowship-dev/dogfooded-skills/skills/ops/setup-githubIMPORTANT: Always verify the Claude GitHub App is installed (https://github.com/apps/claude) BEFORE installing Claude-powered workflows. Without the app, workflows will fail with authentication errors.
为仓库搭建完整的GitHub环境:项目看板、标签和Actions工作流。每个阶段都是幂等的——会检测现有配置并跳过重复操作。
通过npx安装:
bash
npx skills add fellowship-dev/dogfooded-skills/skills/ops/setup-github重要提示:在安装Claude驱动的工作流之前,请务必确认已安装Claude GitHub App(https://github.com/apps/claude)。如果没有安装该应用,工作流会因认证错误而失败。
When to Use
使用场景
- Setting up a new repo's GitHub environment end-to-end
- Adding the automated review pipeline (double-check → cto-review)
- Creating standard labels for workflow tracking
- Installing CI/CD workflows
- 为新仓库端到端搭建GitHub环境
- 添加自动化审查流水线(double-check → cto-review)
- 创建用于工作流跟踪的标准标签
- 安装CI/CD工作流
The Review Pipeline
审查流水线
This skill sets up the automated 3-stage PR review pipeline:
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 approvedSkills powering stages 3-4: and from .
double-checkcto-reviewfellowship-dev/dogfooded-skills本技能会搭建一个自动化的三阶段PR审查流水线:
1. PR已提交
↓
2. GitHub Actions: claude-code-review.yml
- Claude审查代码差异
- 应用"reviewed"标签
↓
3. event-rules.yml: review-pr-on-reviewed
- 触发/double-check PR_NUMBER org/repo命令
- 整理CI检查结果,修复必须解决的问题
- 应用"double-checked"标签
↓
4. event-rules.yml: cto-review-on-double-checked
- 触发/cto-review PR_NUMBER org/repo命令
- 执行文档/依赖/下游检查清单
- 应用"approved"或"needs-work"标签
- 若通过审查则合并PR支撑第3-4阶段的技能:来自的和。
fellowship-dev/dogfooded-skillsdouble-checkcto-reviewPrerequisites: Claude GitHub App
前置条件:Claude GitHub App
Before using Claude-powered workflows, install the Claude GitHub App:
-
Install: https://github.com/apps/claude — select your repository or org
-
Authentication (choose ONE):Option A: OAuth Token via Claude CLI (Recommended)bash
unset GH_TOKEN gh auth login claude /install-github-app # Select repo → "long-lived token" → auto-adds CLAUDE_CODE_OAUTH_TOKEN secretOption B: API Key- Get key: https://console.anthropic.com/settings/keys
- Add as secret at: https://github.com/{owner}/{repo}/settings/secrets/actions
ANTHROPIC_API_KEY
在使用Claude驱动的工作流之前,请安装Claude GitHub App:
-
安装:访问https://github.com/apps/claude —— 选择你的仓库或组织
-
认证(选择其中一种方式):选项A:通过Claude CLI获取OAuth令牌(推荐)bash
unset GH_TOKEN gh auth login claude /install-github-app # 选择仓库 → "长期令牌" → 自动添加CLAUDE_CODE_OAUTH_TOKEN密钥选项B:API密钥- 获取密钥:https://console.anthropic.com/settings/keys
- 在以下地址添加为密钥:https://github.com/{owner}/{repo}/settings/secrets/actions
ANTHROPIC_API_KEY
Instructions
操作步骤
1. Detection Phase
1. 检测阶段
Analyze the repository:
bash
undefined分析仓库:
bash
undefinedRepo identity
仓库信息
gh repo view --json nameWithOwner
gh repo view --json nameWithOwner
Existing labels
现有标签
gh label list --repo $REPO --json name
gh label list --repo $REPO --json name
Existing workflows
现有工作流
ls .github/workflows/ 2>/dev/null || echo "No workflows"
ls .github/workflows/ 2>/dev/null || echo "No workflows"
Project board
项目看板
gh project list --owner $ORG --format json 2>/dev/null | head -20
Report a status table: what exists vs. what's missing.gh project list --owner $ORG --format json 2>/dev/null | head -20
生成状态表格报告:已存在的内容 vs 缺失的内容。2. Labels Phase
2. 标签阶段
Skip labels that already exist (idempotent). Create via :
gh label createWorkflow Labels (for PR pipeline):
| Label | Color | Description |
|---|---|---|
| | CI/automated review complete |
| | Full review + fixes complete |
| | CTO approved — ready to merge |
| | Needs work before merge |
| | Ready for implementation |
| | Actively being worked on |
Type Labels:
| Label | Color | Description |
|---|---|---|
| | Something isn't working |
| | New feature or improvement |
| | Documentation only |
| | Infra/tooling/refactoring |
bash
undefined跳过已存在的标签(幂等操作)。通过创建标签:
gh label create工作流标签(用于PR流水线):
| 标签 | 颜色 | 描述 |
|---|---|---|
| | CI/自动化审查完成 |
| | 全面审查+修复完成 |
| | CTO已批准——可合并 |
| | 需修改后才能合并 |
| | 可开始实施 |
| | 正在进行中 |
类型标签:
| 标签 | 颜色 | 描述 |
|---|---|---|
| | 功能异常 |
| | 新功能或改进 |
| | 仅文档相关 |
| | 基础设施/工具/重构 |
bash
undefinedCreate all labels (idempotent — 2>/dev/null suppresses "already exists" errors)
创建所有标签(幂等操作——2>/dev/null抑制"已存在"错误)
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
Report: "Created N labels, skipped N (already existed)."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. Project Board Phase
3. 项目看板阶段
Skip if a GitHub Project already exists for this repo.
bash
undefined如果该仓库已有GitHub项目,则跳过此步骤。
bash
undefinedCreate project
创建项目
gh project create --owner $ORG --title "$REPO_NAME"
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)
(使用GitHub UI配置状态选项——API支持有限)
Columns: Backlog → Ready → In Progress → In Review → Done
列:Backlog → Ready → In Progress → In Review → Done
Link repo to project
将仓库关联到项目
gh project link $PROJECT_NUMBER --owner $ORG --repo $REPO
Note: Configure auto-move automations in the GitHub Projects UI:
- Auto-move to "In Review" when PR opened
- Auto-move to "Done" when PR merged or issue closedgh project link $PROJECT_NUMBER --owner $ORG --repo $REPO
注意:在GitHub Projects UI中配置自动移动规则:
- 当PR提交时自动移动到"In Review"
- 当PR合并或问题关闭时自动移动到"Done"4. Workflow Installation Phase
4. 工作流安装阶段
Skip workflows that already exist in .
.github/workflows/Present available workflows and wait for confirmation:
跳过中已存在的工作流。
.github/workflows/展示可用的工作流并等待确认:
AI-Powered Workflows (require Claude GitHub App)
AI驱动的工作流(需要Claude GitHub App)
- claude-code-review.yml — Automated PR reviews. Adds label. Recommended — this triggers the full review pipeline.
reviewed - claude-issue-triage.yml — Auto-label new issues
- claude-prd-creation.yml — Generate PRDs from feature requests
- claude-code-review.yml —— 自动化PR审查。添加标签。推荐安装——这会触发完整的审查流水线。
reviewed - claude-issue-triage.yml —— 自动为新问题添加标签
- claude-prd-creation.yml —— 根据功能请求生成PRD文档
Deployment Workflows
部署工作流
- deploy-fly.yml — Deploy to Fly.io
- deploy-ecs-production.yml — Deploy to AWS ECS (production)
- deploy-ecs-staging.yml — Deploy to AWS ECS (staging)
- deploy-mkdocs.yml — Build and deploy docs to GitHub Pages
- deploy-fly.yml —— 部署到Fly.io
- deploy-ecs-production.yml —— 部署到AWS ECS(生产环境)
- deploy-ecs-staging.yml —— 部署到AWS ECS(预发布环境)
- deploy-mkdocs.yml —— 构建并部署文档到GitHub Pages
Maintenance
维护工作流
- dependabot.yml — Automated dependency updates (weekly)
- sync-api-docs.yml — Sync docs to separate repository
After confirmation, install selected workflows:
bash
mkdir -p .github/workflows- dependabot.yml —— 自动化依赖更新(每周)
- sync-api-docs.yml —— 将文档同步到单独的仓库
确认后,安装选定的工作流:
bash
mkdir -p .github/workflowsCopy selected templates from this skill's templates/ directory
从本技能的templates/目录复制选定的模板
Skip if file already exists
如果文件已存在则跳过
undefinedundefined5. Summary Phase
5. 总结阶段
undefinedundefinedGitHub Setup Complete: $REPO
GitHub 设置完成:$REPO
Labels
标签
- ✅ Created N labels, skipped N (already existed)
- ✅ 已创建N个标签,跳过N个(已存在)
Project Board
项目看板
- ✅ Created "$REPO_NAME" project (or "Skipped — already exists") ⚠️ Configure automations manually in project settings
- ✅ 已创建"$REPO_NAME"项目(或"已跳过——已存在") ⚠️ 请在项目设置中手动配置自动化规则
Workflows
工作流
- ✅ Installed: claude-code-review.yml
- ⏭️ Skipped: dependabot.yml (already existed)
- ⚠️ Secrets needed: ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN
- ✅ 已安装:claude-code-review.yml
- ⏭️ 已跳过:dependabot.yml(已存在)
- ⚠️ 需要添加密钥:ANTHROPIC_API_KEY 或 CLAUDE_CODE_OAUTH_TOKEN
Review Pipeline (after claude-code-review.yml is installed)
审查流水线(安装claude-code-review.yml后)
PR opened → reviewed label → double-check → double-checked label → cto-review → approved/needs-work
PR提交 → 应用reviewed标签 → double-check → 应用double-checked标签 → 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 GitHub App:https://github.com/apps/claude
- 添加ANTHROPIC_API_KEY或CLAUDE_CODE_OAUTH_TOKEN密钥
- 配置项目看板自动化规则(链接如上)
- 配置event-rules.yml中的review-pr-on-reviewed和cto-review-on-double-checked规则
---Workflow Catalog
工作流目录
All Claude workflows require or .
ANTHROPIC_API_KEYCLAUDE_CODE_OAUTH_TOKEN| Workflow | Trigger | Output | Pipeline Role |
|---|---|---|---|
| PR opened/reopened | Review comment + | Stage 1 |
| New issue | Labels + priority | Standalone |
| Issue label or @claude | PRD document | Standalone |
| Push to main | Fly.io deploy | CD |
| Push to main | ECS deploy (prod) | CD |
| Push to develop | ECS deploy (staging) | CD |
| Weekly cron | Dep update PRs | Maintenance |
所有Claude工作流都需要或。
ANTHROPIC_API_KEYCLAUDE_CODE_OAUTH_TOKEN| 工作流 | 触发条件 | 输出 | 流水线角色 |
|---|---|---|---|
| PR提交/重新打开 | 审查评论 + | 第1阶段 |
| 新问题创建 | 标签 + 优先级 | 独立功能 |
| 问题标签或@claude | PRD文档 | 独立功能 |
| 推送到main分支 | 部署到Fly.io | CD |
| 推送到main分支 | 部署到ECS(生产环境) | CD |
| 推送到develop分支 | 部署到ECS(预发布环境) | CD |
| 每周定时任务 | 依赖更新PR | 维护 |
Required Secrets
必需的密钥
| Secret | Where | Notes |
|---|---|---|
| https://console.anthropic.com/settings/keys | Recommended. Starts |
| Run | Alternative to API key |
| | For Fly.io deployment |
| AWS IAM Console | For ECS deployment |
| AWS IAM Console | For ECS deployment |
| 密钥 | 获取位置 | 说明 |
|---|---|---|
| https://console.anthropic.com/settings/keys | 推荐使用。以 |
| 运行 | API密钥的替代方案 |
| | 用于Fly.io部署 |
| AWS IAM控制台 | 用于ECS部署 |
| AWS IAM控制台 | 用于ECS部署 |
Supporting Files
支持文件
- — Generic Claude PR review workflow
templates/claude-code-review.yml - — Issue labeling workflow
templates/claude-issue-triage.yml - — PRD generation workflow
templates/claude-prd-creation.yml - — Dependabot config
templates/dependabot.yml - — Fly.io deployment
templates/deploy-fly.yml - — AWS ECS production
templates/deploy-ecs-production.yml - — AWS ECS staging
templates/deploy-ecs-staging.yml - — MkDocs documentation
templates/deploy-mkdocs.yml
- —— 通用Claude PR审查工作流
templates/claude-code-review.yml - —— 问题标签工作流
templates/claude-issue-triage.yml - —— PRD生成工作流
templates/claude-prd-creation.yml - —— Dependabot配置
templates/dependabot.yml - —— Fly.io部署工作流
templates/deploy-fly.yml - —— AWS ECS生产环境部署工作流
templates/deploy-ecs-production.yml - —— AWS ECS预发布环境部署工作流
templates/deploy-ecs-staging.yml - —— MkDocs文档部署工作流
templates/deploy-mkdocs.yml