github-operations by yonatangross/orchestkit
npx skills add https://github.com/yonatangross/orchestkit --skill github-operations全面的 GitHub CLI (gh) 操作,用于项目管理,从基础问题创建到高级 Projects v2 集成以及通过 REST API 进行的里程碑跟踪。
gh 自动化批量操作# 创建带有标签和里程碑的问题
gh issue create --title "Bug: API returns 500" --body "..." --label "bug" --milestone "Sprint 5"
# 列出并筛选问题
gh issue list --state open --label "backend" --assignee @me
# 编辑问题元数据
gh issue edit 123 --add-label "high" --milestone "v2.0"
# 创建带有审阅者的拉取请求
gh pr create --title "feat: Add search" --body "..." --base dev --reviewer @teammate
# 查看 CI 状态并自动合并
gh pr checks 456 --watch
gh pr merge 456 --auto --squash --delete-branch
# 恢复与拉取请求关联的会话 (CC 2.1.27)
claude --from-pr 456 # 使用拉取请求上下文(差异、评论、审阅状态)恢复会话
claude --from-pr https://github.com/org/repo/pull/456
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
提示 (CC 2.1.27): 通过
gh pr create创建的会话会自动链接到拉取请求。使用--from-pr可恢复完整的拉取请求上下文。
注意陷阱:
gh issue edit --milestone接收的是名称(字符串),而不是数字。REST API 使用的是编号(整数)。切勿向--milestone传递数字。请加载Read("${CLAUDE_SKILL_DIR}/references/cli-vs-api-identifiers.md")。
# 列出里程碑及其进度
gh api repos/:owner/:repo/milestones --jq '.[] | "\(.title): \(.closed_issues)/\(.open_issues + .closed_issues)"'
# 创建带有截止日期的里程碑
gh api -X POST repos/:owner/:repo/milestones \
-f title="Sprint 8" -f due_on="2026-02-15T00:00:00Z"
# 关闭里程碑 (API 使用编号,而非名称)
MILESTONE_NUM=$(gh api repos/:owner/:repo/milestones --jq '.[] | select(.title=="Sprint 8") | .number')
gh api -X PATCH repos/:owner/:repo/milestones/$MILESTONE_NUM -f state=closed
# 将问题分配给里程碑 (CLI 使用名称,而非编号)
gh issue edit 123 124 125 --milestone "Sprint 8"
# 将问题添加到项目
gh project item-add 1 --owner @me --url https://github.com/org/repo/issues/123
# 设置自定义字段 (需要 GraphQL)
gh api graphql -f query='mutation {...}' -f projectId="..." -f itemId="..."
# 获取符合条件的问题编号
gh issue list --json number,labels --jq '[.[] | select(.labels[].name == "bug")] | .[].number'
# 包含作者的拉取请求摘要
gh pr list --json number,title,author --jq '.[] | "\(.number): \(.title) by \(.author.login)"'
# 查找准备合并的拉取请求
gh pr list --json number,reviewDecision,statusCheckRollupState \
--jq '[.[] | select(.reviewDecision == "APPROVED" and .statusCheckRollupState == "SUCCESS")]'
| 里程碑 | 史诗 |
|---|---|
| 基于时间(冲刺、发布) | 基于主题(功能) |
| 有截止日期 | 无截止日期 |
| 进度条 | 任务列表复选框 |
| 原生 REST API | 需要变通方案 |
规则:使用里程碑表示“何时”,使用父级问题表示“什么”。
Projects v2 使用 GraphQL 来设置自定义字段(状态、优先级、领域)。基本的 gh project 命令可用于列出和添加项目,但字段更新需要 GraphQL 变更操作。
| 规则 | 影响 | 涵盖内容 |
|---|---|---|
issue-tracking-automation (加载 ${CLAUDE_SKILL_DIR}/rules/issue-tracking-automation.md) | 高 | 提交、子任务完成、会话摘要的自动进度更新 |
issue-branch-linking (加载 ${CLAUDE_SKILL_DIR}/rules/issue-branch-linking.md) | 中 | 分支命名、提交引用、拉取请求链接模式 |
当需要一次性创建多个问题时(例如,为冲刺填充任务),请使用数组驱动的循环:
# 将问题定义为 "标题|标签|里程碑" 条目的数组
SPRINT="Sprint 9"
ISSUES=(
"feat: Add user auth|enhancement,backend|$SPRINT"
"fix: Login redirect loop|bug,high|$SPRINT"
"chore: Update dependencies|maintenance|$SPRINT"
)
for entry in "${ISSUES[@]}"; do
IFS='|' read -r title labels milestone <<< "$entry"
NUM=$(gh issue create \
--title "$title" \
--label "$labels" \
--milestone "$milestone" \
--body "" \
--json number --jq '.number')
echo "Created #$NUM: $title"
done
提示: 使用
--json number --jq '.number'捕获创建的问题编号,以便立即引用(例如,添加到 Projects v2,在拉取请求中链接)。
--json - 使用 --jq 进行解析以确保可靠性--title、--body 标志gh api rate_limit--body "$(cat <<'EOF'...EOF)"Closes #123、Fixes #456 — GitHub 在合并时自动关闭YYYY-MM-DDTHH:MM:SSZ 用于里程碑的 due_on--milestone 接收名称,而非编号 - 加载 Read("${CLAUDE_SKILL_DIR}/references/cli-vs-api-identifiers.md")gh issue close - 使用 gh issue comment 评论进度;问题仅在其关联的拉取请求合并到默认分支时才关闭ork:create-pr - 创建具有适当格式和审阅分配的拉取请求ork:review-pr - 使用专业代理进行全面的拉取请求审阅ork:release-management - 包含语义化版本控制和变更日志的 GitHub 发布工作流stacked-prs - 管理具有变基协调的依赖拉取请求ork:issue-progress-tracking - 根据提交自动更新问题进度| 决策 | 选择 | 理由 |
|---|---|---|
| CLI vs API | 首选 gh CLI | 身份验证更简单,用户体验更好,自动处理分页 |
| 输出格式 | --json 配合 --jq | 自动化解析可靠,无需正则表达式解析 |
| 里程碑 vs 史诗 | 里程碑用于时间 | 里程碑有截止日期和进度条,史诗用于主题分组 |
| Projects v2 字段 | GraphQL 变更操作 | gh project 命令功能有限,自定义字段需要 GraphQL |
| 里程碑生命周期 | 关闭,不删除 | 保留历史记录和进度跟踪 |
使用 Read("${CLAUDE_SKILL_DIR}/references/<file>") 按需加载:
| 文件 | 内容 |
|---|---|
issue-management.md | 批量操作、模板、子问题 |
pr-workflows.md | 审阅、合并策略、自动合并 |
milestone-api.md | 里程碑 CRUD 的 REST API 模式 |
projects-v2.md | 自定义字段、GraphQL 变更操作 |
graphql-api.md | 复杂查询、分页、批量操作 |
cli-vs-api-identifiers.md | 名称与编号的陷阱、里程碑/项目 ID 映射 |
加载:Read("${CLAUDE_SKILL_DIR}/examples/automation-scripts.md") - 用于批量操作、拉取请求自动化、里程碑管理的即用型脚本
每周安装数
88
代码仓库
GitHub 星标数
134
首次出现
2026年1月22日
安全审计
安装于
opencode79
gemini-cli79
github-copilot77
codex77
cursor77
amp71
Comprehensive GitHub CLI (gh) operations for project management, from basic issue creation to advanced Projects v2 integration and milestone tracking via REST API.
gh# Create issue with labels and milestone
gh issue create --title "Bug: API returns 500" --body "..." --label "bug" --milestone "Sprint 5"
# List and filter issues
gh issue list --state open --label "backend" --assignee @me
# Edit issue metadata
gh issue edit 123 --add-label "high" --milestone "v2.0"
# Create PR with reviewers
gh pr create --title "feat: Add search" --body "..." --base dev --reviewer @teammate
# Watch CI status and auto-merge
gh pr checks 456 --watch
gh pr merge 456 --auto --squash --delete-branch
# Resume a session linked to a PR (CC 2.1.27)
claude --from-pr 456 # Resume session with PR context (diff, comments, review status)
claude --from-pr https://github.com/org/repo/pull/456
Tip (CC 2.1.27): Sessions created via
gh pr createare automatically linked to the PR. Use--from-prto resume with full PR context.
Footgun:
gh issue edit --milestonetakes a NAME (string), not a number. The REST API uses a NUMBER (integer). Never pass a number to--milestone. LoadRead("${CLAUDE_SKILL_DIR}/references/cli-vs-api-identifiers.md").
# List milestones with progress
gh api repos/:owner/:repo/milestones --jq '.[] | "\(.title): \(.closed_issues)/\(.open_issues + .closed_issues)"'
# Create milestone with due date
gh api -X POST repos/:owner/:repo/milestones \
-f title="Sprint 8" -f due_on="2026-02-15T00:00:00Z"
# Close milestone (API uses number, not name)
MILESTONE_NUM=$(gh api repos/:owner/:repo/milestones --jq '.[] | select(.title=="Sprint 8") | .number')
gh api -X PATCH repos/:owner/:repo/milestones/$MILESTONE_NUM -f state=closed
# Assign issues to milestone (CLI uses name, not number)
gh issue edit 123 124 125 --milestone "Sprint 8"
# Add issue to project
gh project item-add 1 --owner @me --url https://github.com/org/repo/issues/123
# Set custom field (requires GraphQL)
gh api graphql -f query='mutation {...}' -f projectId="..." -f itemId="..."
# Get issue numbers matching criteria
gh issue list --json number,labels --jq '[.[] | select(.labels[].name == "bug")] | .[].number'
# PR summary with author
gh pr list --json number,title,author --jq '.[] | "\(.number): \(.title) by \(.author.login)"'
# Find ready-to-merge PRs
gh pr list --json number,reviewDecision,statusCheckRollupState \
--jq '[.[] | select(.reviewDecision == "APPROVED" and .statusCheckRollupState == "SUCCESS")]'
| Milestones | Epics |
|---|---|
| Time-based (sprints, releases) | Topic-based (features) |
| Has due date | No due date |
| Progress bar | Task list checkbox |
| Native REST API | Needs workarounds |
Rule : Use milestones for "when", use parent issues for "what".
Projects v2 uses GraphQL for setting custom fields (Status, Priority, Domain). Basic gh project commands work for listing and adding items, but field updates require GraphQL mutations.
| Rule | Impact | What It Covers |
|---|---|---|
issue-tracking-automation (load ${CLAUDE_SKILL_DIR}/rules/issue-tracking-automation.md) | HIGH | Auto-progress from commits, sub-task completion, session summaries |
issue-branch-linking (load ${CLAUDE_SKILL_DIR}/rules/issue-branch-linking.md) | MEDIUM | Branch naming, commit references, PR linking patterns |
When creating multiple issues at once (e.g., seeding a sprint), use an array-driven loop:
# Define issues as an array of "title|labels|milestone" entries
SPRINT="Sprint 9"
ISSUES=(
"feat: Add user auth|enhancement,backend|$SPRINT"
"fix: Login redirect loop|bug,high|$SPRINT"
"chore: Update dependencies|maintenance|$SPRINT"
)
for entry in "${ISSUES[@]}"; do
IFS='|' read -r title labels milestone <<< "$entry"
NUM=$(gh issue create \
--title "$title" \
--label "$labels" \
--milestone "$milestone" \
--body "" \
--json number --jq '.number')
echo "Created #$NUM: $title"
done
Tip: Capture the created issue number with
--json number --jq '.number'so you can reference it immediately (e.g., add to Projects v2, link in PRs).
--json for scripting - Parse with --jq for reliability--title, --body flagsgh api rate_limit--body "$(cat <<'EOF'...EOF)"Closes #123, Fixes #456 — GitHub auto-closes on mergeYYYY-MM-DDTHH:MM:SSZ for milestone due_onork:create-pr - Create pull requests with proper formatting and review assignmentsork:review-pr - Comprehensive PR review with specialized agentsork:release-management - GitHub release workflow with semantic versioning and changelogsstacked-prs - Manage dependent PRs with rebase coordinationork:issue-progress-tracking - Automatic issue progress updates from commits| Decision | Choice | Rationale |
|---|---|---|
| CLI vs API | gh CLI preferred | Simpler auth, better UX, handles pagination automatically |
| Output format | --json with --jq | Reliable parsing for automation, no regex parsing needed |
| Milestones vs Epics | Milestones for time | Milestones have due dates and progress bars, epics for topic grouping |
| Projects v2 fields | GraphQL mutations | gh project commands limited, GraphQL required for custom fields |
| Milestone lifecycle | Close, don't delete | Preserves history and progress tracking |
Load on demand with Read("${CLAUDE_SKILL_DIR}/references/<file>"):
| File | Content |
|---|---|
issue-management.md | Bulk operations, templates, sub-issues |
pr-workflows.md | Reviews, merge strategies, auto-merge |
milestone-api.md | REST API patterns for milestone CRUD |
projects-v2.md | Custom fields, GraphQL mutations |
graphql-api.md | Complex queries, pagination, bulk operations |
cli-vs-api-identifiers.md |
Load: Read("${CLAUDE_SKILL_DIR}/examples/automation-scripts.md") - Ready-to-use scripts for bulk operations, PR automation, milestone management
Weekly Installs
88
Repository
GitHub Stars
134
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode79
gemini-cli79
github-copilot77
codex77
cursor77
amp71
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
43,100 周安装
--milestone takes NAME, not number - Load Read("${CLAUDE_SKILL_DIR}/references/cli-vs-api-identifiers.md")gh issue close directly - Comment progress with gh issue comment; issues close only when their linked PR merges to the default branch| NAME vs NUMBER footguns, milestone/project ID mapping |