setup-github

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub 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-github
IMPORTANT: 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 approved
Skills powering stages 3-4:
double-check
and
cto-review
from
fellowship-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-skills
double-check
cto-review

Prerequisites: Claude GitHub App

前置条件:Claude GitHub App

Before using Claude-powered workflows, install the Claude GitHub App:
  1. Install: https://github.com/apps/claude — select your repository or org
  2. 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 secret
    Option B: API Key

在使用Claude驱动的工作流之前,请安装Claude GitHub App:
  1. 安装:访问https://github.com/apps/claude —— 选择你的仓库或组织
  2. 认证(选择其中一种方式):
    选项A:通过Claude CLI获取OAuth令牌(推荐)
    bash
    unset GH_TOKEN
    gh auth login
    claude
    /install-github-app
    # 选择仓库 → "长期令牌" → 自动添加CLAUDE_CODE_OAUTH_TOKEN密钥
    选项B:API密钥

Instructions

操作步骤

1. Detection Phase

1. 检测阶段

Analyze the repository:
bash
undefined
分析仓库:
bash
undefined

Repo 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 create
:
Workflow Labels (for PR pipeline):
LabelColorDescription
reviewed
#3da46e
CI/automated review complete
double-checked
#0075ca
Full review + fixes complete
approved
#0e8a16
CTO approved — ready to merge
needs-work
#d93f0b
Needs work before merge
ready-to-work
#f6a80a
Ready for implementation
in-progress
#97f157
Actively being worked on
Type Labels:
LabelColorDescription
bug
#d73a4a
Something isn't working
enhancement
#54d9ee
New feature or improvement
documentation
#0075ca
Documentation only
groundwork
#C5DEF5
Infra/tooling/refactoring
bash
undefined
跳过已存在的标签(幂等操作)。通过
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
基础设施/工具/重构
bash
undefined

Create 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
undefined

Create 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 closed
gh 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
    reviewed
    label. Recommended — this triggers the full review pipeline.
  • 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/workflows

Copy selected templates from this skill's templates/ directory

从本技能的templates/目录复制选定的模板

Skip if file already exists

如果文件已存在则跳过

undefined
undefined

5. Summary Phase

5. 总结阶段

undefined
undefined

GitHub 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
ANTHROPIC_API_KEY
or
CLAUDE_CODE_OAUTH_TOKEN
.
WorkflowTriggerOutputPipeline Role
claude-code-review.yml
PR opened/reopenedReview comment +
reviewed
label
Stage 1
claude-issue-triage.yml
New issueLabels + priorityStandalone
claude-prd-creation.yml
Issue label or @claudePRD documentStandalone
deploy-fly.yml
Push to mainFly.io deployCD
deploy-ecs-production.yml
Push to mainECS deploy (prod)CD
deploy-ecs-staging.yml
Push to developECS deploy (staging)CD
dependabot.yml
Weekly cronDep update PRsMaintenance

所有Claude工作流都需要
ANTHROPIC_API_KEY
CLAUDE_CODE_OAUTH_TOKEN
工作流触发条件输出流水线角色
claude-code-review.yml
PR提交/重新打开审查评论 +
reviewed
标签
第1阶段
claude-issue-triage.yml
新问题创建标签 + 优先级独立功能
claude-prd-creation.yml
问题标签或@claudePRD文档独立功能
deploy-fly.yml
推送到main分支部署到Fly.ioCD
deploy-ecs-production.yml
推送到main分支部署到ECS(生产环境)CD
deploy-ecs-staging.yml
推送到develop分支部署到ECS(预发布环境)CD
dependabot.yml
每周定时任务依赖更新PR维护

Required Secrets

必需的密钥

SecretWhereNotes
ANTHROPIC_API_KEY
https://console.anthropic.com/settings/keysRecommended. Starts
sk-ant-
CLAUDE_CODE_OAUTH_TOKEN
Run
claude /install-github-app
Alternative to API key
FLY_API_TOKEN
flyctl auth token
For Fly.io deployment
AWS_ACCESS_KEY_ID
AWS IAM ConsoleFor ECS deployment
AWS_SECRET_ACCESS_KEY
AWS IAM ConsoleFor ECS deployment

密钥获取位置说明
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部署

Supporting Files

支持文件

  • templates/claude-code-review.yml
    — Generic Claude PR review workflow
  • templates/claude-issue-triage.yml
    — Issue labeling workflow
  • templates/claude-prd-creation.yml
    — PRD generation workflow
  • templates/dependabot.yml
    — Dependabot config
  • templates/deploy-fly.yml
    — Fly.io deployment
  • templates/deploy-ecs-production.yml
    — AWS ECS production
  • templates/deploy-ecs-staging.yml
    — AWS ECS staging
  • templates/deploy-mkdocs.yml
    — MkDocs documentation
  • 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文档部署工作流