copilot-coding-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Copilot Coding Agent — Issue → Draft PR automation

GitHub Copilot Coding Agent — 议题→草稿PR自动化流程

If you add the
ai-copilot
label to an issue, GitHub Actions automatically assigns it to Copilot, and Copilot creates a branch → writes code → opens a Draft PR.
若为议题添加
ai-copilot
标签,GitHub Actions会自动将其分配给Copilot,Copilot会创建分支→编写代码→打开草稿PR。

When to use this skill

何时使用该功能

  • When PMs/designers create issues and Copilot starts implementation without a developer
  • When offloading backlog issues (refactors/docs/tests) to Copilot
  • When delegating follow-up work created by Vibe Kanban / Conductor to Copilot
  • When automating pipelines like Jira → GitHub Issue → Copilot PR

  • 当产品经理/设计师创建议题后,无需开发人员介入,Copilot即可启动开发工作
  • 将积压的议题(重构/文档/测试)交付给Copilot处理
  • 将Vibe Kanban / Conductor生成的后续工作委托给Copilot处理
  • 实现Jira→GitHub议题→Copilot PR这类流水线的自动化

Prerequisites

前置条件

  • GitHub plan: Copilot Pro+, Business, or Enterprise
  • Copilot Coding Agent enabled: Must be enabled in repo settings
  • gh CLI: Authenticated
  • PAT: Personal Access Token with
    repo
    scope

  • GitHub套餐:Copilot Pro+、Business或Enterprise版
  • Copilot Coding Agent已启用:需在仓库设置中启用
  • gh CLI:已完成身份验证
  • PAT:拥有
    repo
    权限的个人访问令牌

One-time setup

一次性设置

bash
undefined
bash
undefined

One-click setup (register token + deploy workflow + create label)

一键式设置(注册令牌 + 部署工作流 + 创建标签)

bash scripts/copilot-setup-workflow.sh

This script does:
1. Register `COPILOT_ASSIGN_TOKEN` as a repo secret
2. Deploy `.github/workflows/assign-to-copilot.yml`
3. Create the `ai-copilot` label

---
bash scripts/copilot-setup-workflow.sh

该脚本会完成以下操作:
1. 将`COPILOT_ASSIGN_TOKEN`注册为仓库密钥
2. 部署`.github/workflows/assign-to-copilot.yml`工作流
3. 创建`ai-copilot`标签

---

Usage

使用方法

Option 1: GitHub Actions automation (recommended)

选项1:GitHub Actions自动化(推荐)

bash
undefined
bash
undefined

Create issue + ai-copilot label → auto-assign Copilot

创建议题并添加ai-copilot标签→自动分配给Copilot

gh issue create
--label ai-copilot
--title "Add user authentication"
--body "Implement JWT-based auth with refresh tokens. Include login, logout, refresh endpoints."
undefined
gh issue create
--label ai-copilot
--title "添加用户认证功能"
--body "实现基于JWT的认证并包含刷新令牌,涵盖登录、登出、刷新接口。"
undefined

Option 2: Add a label to an existing issue

选项2:为现有议题添加标签

bash
undefined
bash
undefined

Add label to issue #42 → trigger Actions

为编号42的议题添加标签→触发Actions

gh issue edit 42 --add-label ai-copilot
undefined
gh issue edit 42 --add-label ai-copilot
undefined

Option 3: Assign directly via script

选项3:通过脚本直接分配

bash
export COPILOT_ASSIGN_TOKEN=<your-pat>
bash scripts/copilot-assign-issue.sh 42

bash
export COPILOT_ASSIGN_TOKEN=<你的PAT令牌>
bash scripts/copilot-assign-issue.sh 42

How it works (technical)

工作原理(技术细节)

Issue created/labeled
GitHub Actions triggered (assign-to-copilot.yml)
Look up Copilot bot ID via GraphQL
replaceActorsForAssignable → set Copilot as assignee
Copilot Coding Agent starts processing the issue
Create branch → write code → open Draft PR
Auto-assign you as PR reviewer
Required GraphQL header:
GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection

议题创建/添加标签
触发GitHub Actions(assign-to-copilot.yml)
通过GraphQL查询Copilot机器人ID
调用replaceActorsForAssignable→将Copilot设为经办人
Copilot Coding Agent开始处理议题
创建分支→编写代码→打开草稿PR
自动将你设为PR审核人
所需GraphQL请求头:
GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection

GitHub Actions workflows

GitHub Actions工作流

WorkflowTriggerPurpose
assign-to-copilot.yml
Issue labeled
ai-copilot
Auto-assign to Copilot
copilot-pr-ci.yml
PR open/updateRun CI (build + tests)

工作流触发条件用途
assign-to-copilot.yml
议题被添加
ai-copilot
标签
自动分配给Copilot
copilot-pr-ci.yml
PR创建/更新运行CI(构建+测试)

Copilot PR limitations

Copilot PR的限制

Copilot is treated like an external contributor.
  • PRs are created as Draft by default
  • Before the first Actions run, a manual approval from someone with write access is required
  • After approval,
    copilot-pr-ci.yml
    CI runs normally
bash
undefined
Copilot会被视为外部贡献者
  • PR默认以草稿形式创建
  • 首次运行Actions前,需要拥有写入权限的人员进行手动审批
  • 审批通过后,
    copilot-pr-ci.yml
    会正常运行CI
bash
undefined

Check CI after manual approval

手动审批后检查CI状态

gh pr list --search 'head:copilot/' gh pr view <pr-number>

---
gh pr list --search 'head:copilot/' gh pr view <pr编号>

---

planno (plannotator) integration — optional

planno(plannotator)集成 — 可选

Review the issue spec in planno before assigning to Copilot (independent skill, not required):
text
Review and approve this issue spec in planno
After approval, add the
ai-copilot
label → trigger Actions.

在分配给Copilot之前,先在planno中审核议题规格(独立功能,非必需):
text
在planno中审核并批准该议题规格
审批通过后,添加
ai-copilot
标签→触发Actions。

Common use cases

常见使用场景

1. Label-based Copilot queue

1. 基于标签的Copilot任务队列

PM writes an issue → add ai-copilot label
→ Actions auto-assigns → Copilot creates Draft PR
→ Team only performs PR review
产品经理编写议题→添加ai-copilot标签
→Actions自动分配→Copilot创建草稿PR
→团队仅需进行PR审核

2. Combined with Vibe Kanban / Conductor

2. 与Vibe Kanban / Conductor结合使用

Follow-up issues created by Vibe Kanban:
  refactors/docs cleanup/add tests
  → ai-copilot label → Copilot handles
→ Team focuses on main feature development
Vibe Kanban生成的后续议题:
  重构/文档清理/添加测试
  →添加ai-copilot标签→由Copilot处理
→团队专注于主功能开发

3. External system integration

3. 外部系统集成

Jira issue → Zapier/webhook → auto-create GitHub Issue
→ ai-copilot label → Copilot PR
→ Fully automated pipeline
Jira议题→Zapier/ webhook→自动创建GitHub议题
→添加ai-copilot标签→Copilot生成PR
→全自动化流水线

4. Refactoring backlog processing

4. 处理重构积压议题

bash
undefined
bash
undefined

Bulk-add label to backlog issues

为积压议题批量添加标签

gh issue list --label "tech-debt" --json number
| jq '.[].number'
| xargs -I{} gh issue edit {} --add-label ai-copilot

---
gh issue list --label "tech-debt" --json number
| jq '.[].number'
| xargs -I{} gh issue edit {} --add-label ai-copilot

---

Check results

检查结果

bash
undefined
bash
undefined

List PRs created by Copilot

列出Copilot创建的PR

gh pr list --search 'head:copilot/'
gh pr list --search 'head:copilot/'

Specific issue status

查看特定议题状态

gh issue view 42
gh issue view 42

PR CI status

查看PR的CI状态

gh pr checks <pr-number>

---
gh pr checks <pr编号>

---

References

参考资料

Quick Reference

快速参考

=== Setup ===
bash scripts/copilot-setup-workflow.sh   one-time setup

=== Issue assignment ===
gh issue create --label ai-copilot ...  new issue + auto-assign
gh issue edit <num> --add-label ai-copilot  existing issue
bash scripts/copilot-assign-issue.sh <num>  manual assign

=== Verify results ===
gh pr list --search 'head:copilot/'    Copilot PR list
gh pr view <num>                        PR details
gh pr checks <num>                      CI status

=== Constraints ===
Copilot Pro+/Business/Enterprise required
First PR requires manual approval (treated as an external contributor)
PAT: repo scope required
=== 设置 ===
bash scripts/copilot-setup-workflow.sh   一次性设置

=== 议题分配 ===
gh issue create --label ai-copilot ...  新建议题+自动分配
gh issue edit <编号> --add-label ai-copilot  现有议题分配
bash scripts/copilot-assign-issue.sh <编号>  手动分配

=== 验证结果 ===
gh pr list --search 'head:copilot/'    Copilot创建的PR列表
gh pr view <编号>                        PR详情
gh pr checks <编号>                      CI状态

=== 限制条件 ===
需Copilot Pro+/Business/Enterprise版
首个PR需要手动审批(被视为外部贡献者)
PAT需拥有repo权限