SkillAtlasSkill 详情

issue-fields-migration

Powered by Awesome Copilot GitHub contributors from allcontributors.org

审核状态:已审核Quality 80Security 80

复制安装命令

用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。

复制前请先查看来源、License 和安全提示。

项目 README

来源文件:README.md

抓取于 2026年7月29日

🤖 Awesome GitHub Copilot

Powered by Awesome Copilot GitHub contributors from allcontributors.org

A community-created collection of custom agents, instructions, skills, hooks, workflows, and plugins to supercharge your GitHub Copilot experience.

[!TIP] Explore the full collection on the website → awesome-copilot.github.com

The website offers full-text search and filtering across hundreds of resources, plus the Learning Hub for guides and tutorials.

Using this collection in an AI agent? A machine-readable llms.txt is available with structured listings of all agents, instructions, and skills.

📖 Learning Hub

New to GitHub Copilot customization? The Learning Hub on the website offers curated articles, walkthroughs, and reference material — covering everything from core concepts like agents, skills, and instructions to hands-on guides for hooks, agentic workflows, MCP servers, and the Copilot coding agent.

What's in this repo

ResourceDescriptionBrowse
🤖 AgentsSpecialized Copilot agents that integrate with MCP serversAll agents →
📋 InstructionsCoding standards applied automatically by file patternAll instructions →
🎯 SkillsSelf-contained folders with instructions and bundled assetsAll skills →
🔌 PluginsCurated bundles of agents and skills for specific workflowsAll plugins →
🍳 CookbookCopy-paste-ready recipes for working with Copilot APIs—

Install a Plugin

For most users, the Awesome Copilot marketplace is already registered in the Copilot CLI/VS Code, so you can install a plugin directly:

copilot plugin install <plugin-name>@awesome-copilot

If you are using an older Copilot CLI version or a custom setup and see an error that the marketplace is unknown, register it once and then install:

copilot plugin marketplace add github/awesome-copilot
copilot plugin install <plugin-name>@awesome-copilot

Contributing

See CONTRIBUTING.md · AGENTS.md for AI agent guidance · Security · Code of Conduct

The customizations here are sourced from third-party developers. Please inspect any agent and its documentation before installing.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Aaron Powell

Matt Soucoup

Troy Simeon Taylor

Abbas

Peter Strömberg

Daniel Scott-Raynsford

John Haugabook

Pavel Simsa

Harald Kirschner

Muhammad Ubaid Raza

Tom Meschter

Aung Myo Kyaw

JasonYeMSFT

Jon Corbin

troytaylor-msft

Emerson Delatorre

Burke Holland

Kent Yao

Daniel Meppiel

Gordon Lam

Mads Kristensen

Shinji Takenaka

spectatora

Yohan Lasorsa

Vamshi Verma

James Montemagno

Alessandro Fragnani

Ambily

krushideep

devopsfan

Tugdual Grall

Oren Me

Mike Rousos

Justin Yoo

Guilherme do Amaral Alves

Griffin Ashe

Ashley Childress

Adrien Clerbois

ANGELELLI David

Mark Davis

Matt Vevang

Maximilian Irro

NULLchimp

Peter Karda

Saul Dolgin

Shubham Gaikwad

Theo van Kraay

Tianqi Zhang

Will 保哥

Yuta Matsumura

anschnapp

hizahizi-hizumi

黃健旻 Vincent Huang

Bruno Borges

Steve Magne

Shane Neuville

André Silva

Allen Greaves

Amelia Payne

BBoyBen

Brooke Hamilton

Christopher Harrison

Dan

Dan Wahlin

Debbie O'Brien

Ed Harrod

Genevieve Warren

Guillaume

Henrique Nunes

Jeremiah Snee

Kartik Dhiman

Kristiyan Velkov

msalaman

Per Søderlind

Peter Smulovics

Ravish Rathod

Rick Smit

Rob Simpson

Robert Altman

Salih

Sebastian Gräf

Sebastien DEGODEZ

Sergiy Smyrnov

SomeSolutionsArchitect

Stu Mace

Søren Trudsø Mahon

Tj Vita

Peli de Halleux

Paulo Morgado

Paul Crane

Pamela Fox

Oskar Thornblad

Nischay Sharma

Nikolay Marinov

Nik Sachdeva

Nick Taylor

Nick Brady

Nathan Stanford Sr

Máté Barabás

Mike Parker

Mike Kistler

Giovanni de Almeida Martins

이상현

Ankur Sharma

Wendy Breiding

voidfnc

shane lee

sdanzo-hrb

sauran

samqbush

pareenaverma

oleksiyyurchyna

oceans-of-time

kshashank57

Meii

factory-davidgu

dangelov-qa

BenoitMaucotel

benjisho-aidome

Yuki Omoto

Will Schultz

Waren Gonzaga

Vincent Koc

Victor Williams

Ve Sharma

Vasileios Lahanas

Udaya Veeramreddygari

Tài Lê

Tsubasa Ogawa

Troy Witthoeft (glsauto)

Gerald Versluis

George Dernikos

Gautam

Furkan Enes

Florian Mücke

Felix Arjuna

Eldrick Wega

Dobri Danchev

Diego Gamboa

Derek Clair

David Ortinau

Daniel Abbatt

CypherHK

Craig Bekker

Christophe Peugnet

Christian Lechner

Chris Harris

Artem Saveliev

Antoine Rey

Ankit Das

Aline Ávila

Alexander Martinkevich

Aleksandar Dunchev

Alan Sprecacenere

Akash Kumar Shaw

Abdi Daud

AIAlchemyForge

4regab

Miguel P Z

Michael Fairchild

Michael A. Volz (Flynn)

Michael

Mehmet Ali EROL

Max Prilutskiy

Matteo Bianchi

Mark Noble

Manish Jayaswal

Luke Murray

Louella Creemers

Sai Koumudi Kaluvakolanu

Kenny White

KaloyanGenev

Kim Skov Rasmussen

Julien Dubois

José Antonio Garrido

Joseph Gonzales

Jorge Balderas

John Papa

John

Joe Watkins

Jan de Vries

Jakub Jareš

Jackson Miller

Ioana A

Hunter Hogan

Hashim Warren

Gonzalo

Gisela Torres

Shibi Ramachandran

lupritz

Héctor Benedicte

Ted Vilutis

Anthony Shaw

Chris McKee

CASTResearchLabs

白水淳

Imran Siddique

共产主义接班人

Ivan Charapanau

Tadas Labudis

Alvin Ashcraft

Jan Krivanek

Gregg Cochran

Josh N

ian zhang

Garrett Siegel

Roberto Perez

Dan Velton

Lee Reilly

Daniel Coelho

Vahid Faraji

Ashley Wolf

Noah Jenkins

Jeremy Kohn

Harri Sipola

Toru Makabe

Pham Tien Thuan Phat

Benji Shohet

Amaury Levé

Tim Deschryver

Mohammad Asad Alahmadi

fondoger

Yuval Avidani

Csaba Iváncza

Tim Heuer

lance2k

Andrea Liliana Griffiths

Ajith Raghavan

Catherine Han

Igor Shishkin

Burrito Verde

Joseph Van der Wee

Luiz Bon

Sanjay Ramassery Babu

Russ Rimmerman [MSFT]

Roberto Perez

Shehab Sherif

Smit Patel

Steven Vore

Subhashis Bhowmik

Tim Mulholland

Niels Laute

Pavel Sulimau

PrimedPaul

Zhiqi Pu

Ramyashree Shetty

ZdaPhp

pigd0g

rahulbats

suyask-msft

tagedeep

tinkeringDev

Travis Hill

Utkarsh patrikar

Yauhen

Yiou Li

Yuki Omoto

Abhi Bavishi

augustus-0

Branislav Buna

connerlambden

David Raygoza

Diego Porto Ritzel

Eric Scherlinger

Fatih

Felipe Pessoto

François

Geoffrey Casaubon

Anddd7

Anders Eide

Aymen

Kevin van Zonneveld

Luis Cantero

MV Karan

Marcel Deutzer

Jon Galloway

Josh Beard

Julian

Simon Kurtz

Temitayo Afolabi

JoeVenner

Pasindu Premarathna

ecosystem

Punit

Onur Senturk

Andrew Stellman

Jeonghoon Lee

Satya K

Samik Roy

Simina Pasat

Tyler Garner

Vijay Chegu

DTIBeograd

Anmol Behl

Brad Kinnard

Chad Bentz

Marcello Cuoghi

Josh Johanning

jennyf19

Saravanan Rajaraman

Patel Dhruv

Renee Noble

jjpinto

moeyui1

mohammadali2549

Vladislav Guzey

aparna198809

Ed McAdams

Emil Andersson

Mikael

Mrigank Singh

Jim Bennett

Alishahzad1903

Antonio Villanueva

Tim Hanewich

ming

Scott O'Hara

Salih

Shailesh

Shubham Jiyani

Srinivas Vaddi

Philippe D

Rajesh Goldy

dstrupl

wuwen

Tilak Patel

Vijay Bandi

Zixuan Jiang

Dennis Lembree

Dev Shah

Falco

AJ

Anush

Ayush Saklani

Carlos Alexandro Becker

Mangokernel

Mario Codes

Gonzalo Fleming

Steve Magne

Sertxito

Rayner Zeng

ilderaj

mvanderbend-msoft

Parveen Sharma

pmorong

vinod kumar

Vidhart Bhatia

Xiaoyun Ding

denis-a-evdokimov

Adriano Nogueira

Aezan

Andy Anderson

Kweku Dzata

Marcel

Navaneeth Reddy

James

Joseph Counts

Neha Mandge

Srikanth Patchava

Thomas Ray

Nixon Kurian

Petr Stupka

Pieter de Bruin

sudeepghatak

tlietz

dawright22

Alejandro Fernando Suarez Gomez

Burak Bayır

MUHAMMAD SAMIULLAH

Nikola Metulev

Joseph Kasprzyk

Lovy Jain

kimtth

Akash Dwivedi

Suren K
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

📚 Additional Resources

™️ Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

其他

中风险

  • 来源需自行核对维护者身份。
  • 包含脚本或命令调用,安装前请复核。
  • 未检测到明显外部权限要求。
  • 未检测到高风险命令。
  • 扫描发现:3 条。

Codex — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/github/awesome-copilot.git
  3. 将 "skills/issue-fields-migration" 文件夹复制到 Codex 的 skills 目录中。
  4. 重启 Codex 让新的 skill 生效。

Codex — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Codex 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Codex 让新的 skill 生效。

Claude Code — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/github/awesome-copilot.git
  3. 将 "skills/issue-fields-migration" 文件夹复制到 Claude Code 的 skills 目录中。
  4. 重启 Claude Code 让新的 skill 生效。

Claude Code — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Claude Code 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Claude Code 让新的 skill 生效。

Cursor — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/github/awesome-copilot.git
  3. 将 "skills/issue-fields-migration" 文件夹复制到 Cursor 的 skills 目录中。
  4. 重启 Cursor 让新的 skill 生效。

Cursor — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Cursor 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Cursor 让新的 skill 生效。

GitHub Copilot — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/github/awesome-copilot.git
  3. 将 "skills/issue-fields-migration" 文件夹复制到 GitHub Copilot 的 skills 目录中。
  4. 重启 GitHub Copilot 让新的 skill 生效。

GitHub Copilot — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 GitHub Copilot 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 GitHub Copilot 让新的 skill 生效。

Windsurf — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/github/awesome-copilot.git
  3. 将 "skills/issue-fields-migration" 文件夹复制到 Windsurf 的 skills 目录中。
  4. 重启 Windsurf 让新的 skill 生效。

Windsurf — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Windsurf 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Windsurf 让新的 skill 生效。
查看 SKILL.md 原文
name: issue-fields-migration
description: 'Bulk-migrate metadata to GitHub issue fields from two sources: repo labels (e.g. priority labels to a Priority field) and Project V2 fields. Use when users say "migrate my labels to issue fields", "migrate project fields to issue fields", "convert labels to issue fields", "copy project field values to issue fields", or ask about adopting issue fields. Issue fields are org-level typed metadata (single select, text, number, date) that replace label-based workarounds with structured, searchable, cross-repo fields.'

Issue Fields Migration

Issue fields are org-level typed metadata (single select, text, number, date) that replace label-based workarounds with structured, searchable, cross-repo fields. Every organization gets Priority, Effort, Start date, and Target date preconfigured, with support for up to 25 custom fields.

This skill bulk-migrates existing metadata into issue fields from two sources:

  • Repo labels: Convert labels like p0, p1, priority/high into structured issue field values (e.g. the Priority field). Supports migrating multiple labels at once and optionally removing them after migration.
  • Project V2 fields: Copy field values (single select, text, number, date, iteration) from a GitHub Project into the equivalent org-level issue fields.

When to Use

  • User added org-level issue fields that overlap with existing project fields
  • User wants to copy values from project fields to issue fields before deleting the old project fields
  • User asks about "migrating", "transferring", or "copying" project field data to issue fields
  • User wants to convert repo labels (e.g., p0, p1, p2, p3) into issue field values (e.g., Priority field)
  • User asks about replacing labels with issue fields or cleaning up labels after adopting issue fields

Prerequisites

  • The target org must have issue fields enabled
  • The issue fields must already exist at the org level
  • For project field migration: issue fields must be added to the project
  • For label migration: labels must exist on the target repo(s)
  • The user must have write access to the repos (and project, if migrating project fields)
  • gh CLI must be authenticated with appropriate scopes

Available Tools

MCP Tools (read operations)

ToolPurpose
mcp__github__projects_listList project fields (list_project_fields), list project items with values (list_project_items)
mcp__github__projects_getGet details of a specific project field or item

CLI / REST API

OperationCommand
List org issue fieldsgh api /orgs/{org}/issue-fields -H "X-GitHub-Api-Version: 2026-03-10"
Read issue field valuesgh api /repos/{owner}/{repo}/issues/{number}/issue-field-values -H "X-GitHub-Api-Version: 2026-03-10"
Write issue field valuesgh api /repositories/{repo_id}/issues/{number}/issue-field-values -X POST -H "X-GitHub-Api-Version: 2026-03-10" --input -
Get repository IDgh api /repos/{owner}/{repo} --jq .id
List repo labelsgh label list -R {owner}/{repo} --limit 1000 --json name,color,description
List issues by labelgh issue list -R {owner}/{repo} --label "{name}" --state all --json number,title,labels --limit 1000
Remove label from issuegh api /repos/{owner}/{repo}/issues/{number}/labels/{label_name} -X DELETE

See references/issue-fields-api.md, references/projects-api.md, and references/labels-api.md for full API details.

Workflow

Step 0: Migration Source

Ask the user what they are migrating:

  1. "Are you migrating labels or project fields?"

  2. If the user says labels:

    • Ask: "Which org and repo(s) contain the labels?"
    • Ask: "Which labels do you want to migrate?" (they can name them or say "show me the labels first")
  3. If the user says project fields:

    • Ask: "Can you share the link to your project or tell me the org name and project number?"
    • Ask: "Which field do you want to migrate?"

Label Migration Flow

Use this flow when the user wants to convert repo labels into issue field values. Labels can only map to single_select issue fields (each label name maps to one option value).

Phase L1: Input & Label Discovery

  1. Ask the user for: org name and repo(s) to migrate.
  2. Fetch labels from each repo:
gh label list -R {owner}/{repo} --limit 1000 --json name,color,description
  1. Fetch org issue fields:
gh api /orgs/{org}/issue-fields \
  -H "X-GitHub-Api-Version: 2026-03-10" \
  --jq '.[] | {id, name, content_type, options: [.options[]?.name]}'
  1. Filtering (for repos with many labels): if the repo has 50+ labels, group by common prefix (e.g., priority-*, team-*, type-*) or color. Let the user filter with "show labels matching priority" or "show blue labels" before mapping. Never dump 100+ labels at once.

  2. Ask the user which labels map to which issue field and option. Support these patterns:

    • Single label to single field: e.g., label "bug" → Type field, "Bug" option
    • Multiple labels to one field (bulk): e.g., labels p0, p1, p2, p3 → Priority field with matching options
    • Multiple labels to multiple fields: e.g., p1 → Priority + frontend → Team. Handle as separate mapping groups.
  3. Auto-suggest mappings: for each label, attempt to match issue field options using these patterns (in order):

    • Exact match (case-insensitive): label Bug → option Bug
    • Prefix-number ({prefix}-{n} → {P}{n}): label priority-1 → option P1
    • Strip separators (hyphens, underscores, spaces): label good_first_issue → option Good First Issue
    • Substring containment: label type: bug → option Bug

    Present all suggestions at once for the user to confirm, correct, or skip.

Example output:

Labels in github/my-repo (showing relevant ones):
  p0, p1, p2, p3, bug, enhancement, frontend, backend

Org issue fields (single_select):
  Priority: Critical, P0, P1, P2, P3
  Type: Bug, Feature, Task
  Team: Frontend, Backend, Design

Suggested mappings:
  Label "p0" → Priority "P0"
  Label "p1" → Priority "P1"
  Label "p2" → Priority "P2"
  Label "p3" → Priority "P3"
  Label "bug" → Type "Bug"
  Label "frontend" → Team "Frontend"
  Label "backend" → Team "Backend"
  Label "enhancement" → (no auto-match; skip or map manually)

Confirm, adjust, or add more mappings?

Phase L2: Conflict Detection

After finalizing the label-to-option mappings, check for conflicts. A conflict occurs when an issue has multiple labels that map to the same issue field (since single_select fields can hold only one value).

  1. Group label mappings by target issue field.
  2. For each field with multiple label sources, note the potential for conflicts.
  3. Ask the user for a conflict resolution strategy:
    • First match: use the first matching label found (by order of label mapping list)
    • Skip: skip issues with conflicting labels and report them
    • Manual: present each conflict for the user to decide

Example:

Potential conflict: labels "p0" and "p1" both map to the Priority field.
If an issue has both labels, which value should win?

Options:
  1. First match (use "p0" since it appears first in the mapping)
  2. Skip conflicting issues
  3. I'll decide case by case

Phase L3: Pre-flight Checks & Data Scan

  1. For each repo, verify write access and cache the repository_id:
gh api /repos/{owner}/{repo} --jq '{full_name, id, permissions: .permissions}'
  1. For each label in the mapping, fetch matching issues:
gh issue list -R {owner}/{repo} --label "{label_name}" --state all \
  --json number,title,labels,type --limit 1000

Warning: --limit 1000 silently truncates results. If you expect a label may have more than 1000 issues, paginate manually or verify the total count first (e.g., gh issue list --label "X" --state all --json number | jq length).

PR filtering: gh issue list returns both issues and PRs. Include type in the --json output and filter for type == "Issue" if the user only wants issues migrated.

  1. If all selected labels return 0 issues, stop and tell the user. Suggest: try different labels, check spelling, or try a different repository. Do not proceed with an empty migration.

  2. For multi-repo migrations, repeat across all specified repos.

  3. For each issue found:

    • Check if the issue already has a value for the target issue field (skip if set).
    • Detect multi-label conflicts (issue has two labels for the same field).
    • Apply the conflict resolution strategy chosen in Phase L2.
    • Classify: migrate, skip (already set), skip (conflict), or skip (no matching label).

Phase L4: Preview / Dry-Run

Present a summary before any writes.

Example preview:

Label Migration Preview

Source: labels in github/my-repo
Target fields: Priority, Type, Team

| Category                | Count |
|-------------------------|-------|
| Issues to migrate       |   156 |
| Already set (skip)      |    12 |
| Conflicting labels (skip)|    3 |
| Total issues with labels|   171 |

Label breakdown:
  "p1" → Priority "P1": 42 issues
  "p2" → Priority "P2": 67 issues
  "p3" → Priority "P3": 38 issues
  "bug" → Type "Bug": 9 issues

Sample changes (first 5):
  github/my-repo#101: Priority → "P1"
  github/my-repo#203: Priority → "P2", Type → "Bug"
  github/my-repo#44:  Priority → "P3"
  github/my-repo#310: Priority → "P1"
  github/my-repo#7:   Type → "Bug"

After migration, do you also want to remove the migrated labels from issues? (optional)

Estimated time: ~24s (156 API calls at 0.15s each)

Proceed?

Phase L5: Execution

  1. For each issue to migrate, write the issue field value (same endpoint as project field migration):
echo '{"issue_field_values": [{"field_id": FIELD_ID, "value": "OPTION_NAME"}]}' | \
  gh api /repositories/{repo_id}/issues/{number}/issue-field-values \
    -X POST \
    -H "X-GitHub-Api-Version: 2026-03-10" \
    --input -

Replace FIELD_ID with the integer field ID (e.g., 1) and OPTION_NAME with the option name string.

  1. If the user opted to remove labels, remove each migrated label after successful field write:
gh api /repos/{owner}/{repo}/issues/{number}/labels/{label_name} -X DELETE

URL-encode label names that contain spaces or special characters.

  1. Pacing: 100ms delay between calls. Exponential backoff on HTTP 429 (1s, 2s, 4s, up to 30s).
  2. Progress: report every 25 items (e.g., "Migrated 75/156 issues...").
  3. Error handling: log failures but continue. Include label removal failures separately.
  4. Final summary:
Label Migration Complete

| Result                | Count |
|-----------------------|-------|
| Fields set            |   153 |
| Labels removed        |   153 |
| Skipped               |    15 |
| Failed (field write)  |     2 |
| Failed (label remove) |     1 |

Failed items:
  github/my-repo#501: 403 Forbidden (insufficient permissions)
  github/my-repo#88:  422 Validation failed (field not available on repo)
  github/my-repo#120: label removal failed (404, label already removed)

Project Field Migration Flow

Use this flow when the user wants to copy values from a GitHub Project V2 field to the corresponding org-level issue field.

Follow these six phases in order. Always preview before executing.

Phase P1: Input & Discovery

  1. Ask the user for: org name and project number (or project URL).
  2. Fetch project fields:
# Use MCP tool
mcp__github__projects_list(owner: "{org}", project_number: {n}, method: "list_project_fields")
  1. Fetch org issue fields:
gh api /orgs/{org}/issue-fields \
  -H "X-GitHub-Api-Version: 2026-03-10" \
  --jq '.[] | {id, name, content_type, options: [.options[]?.name]}'
  1. Filter out proxy fields: after issue fields are enabled on a project, some project fields appear as "proxy" entries with empty options: [] for single-select types. These mirror the real issue fields and should be ignored. Only match against project fields that have actual option values.

  2. Auto-match fields by name (case-insensitive) with compatible types:

Project Field TypeIssue Field TypeCompatible?
TEXTtextYes, direct copy
SINGLE_SELECTsingle_selectYes, option mapping needed
NUMBERnumberYes, direct copy
DATEdateYes, direct copy
ITERATION(none)No equivalent; skip with warning
  1. Present the proposed field mappings as a table. Let the user confirm, adjust, or skip fields.

Example output:

Found 3 potential field mappings:

| # | Project Field      | Type          | Issue Field        | Status     |
|---|-------------------|---------------|--------------------|------------|
| 1 | Priority (renamed) | SINGLE_SELECT | Priority           | Auto-match |
| 2 | Due Date           | DATE          | Due Date           | Auto-match |
| 3 | Sprint             | ITERATION     | (no equivalent)    | Skipped    |

Proceed with fields 1 and 2? You can also add manual mappings.

Phase P2: Option Mapping (single-select fields only)

For each matched single-select pair:

  1. Compare option names between the project field and issue field (case-insensitive).
  2. Auto-match options with identical names.
  3. For any unmapped project field options, present all unmapped options in a single summary and ask the user to provide mappings for all of them at once. Do not prompt one-by-one; batch them into a single exchange.
  4. Show the final option mapping table for confirmation.

Example output:

Option mapping for "Release - Target":

Auto-matched (case-insensitive):
  "GA" → "GA"
  "Private Preview" → "Private Preview"
  "Public Preview" → "Public Preview"

Unmapped project options (need your input):
  1. "Internal Only" → which issue field option? (or skip)
  2. "Retired" → which issue field option? (or skip)
  3. "Beta" → which issue field option? (or skip)
  4. "Deprecated" → which issue field option? (or skip)

Available issue field options not yet mapped: "Internal", "Sunset", "Beta Testing", "End of Life"

Please provide mappings for all 4 options above (e.g., "1→Internal, 2→Sunset, 3→Beta Testing, 4→skip").

Phase P3: Pre-flight Checks

Before scanning items, verify write access to each repository that may be touched:

  1. From the project items (first page), collect the unique set of {owner}/{repo} values.
  2. For each unique repo, verify the authenticated user has Issues write permission:
gh api /repos/{owner}/{repo} --jq '{full_name, permissions: .permissions}'
  1. If any repo shows push: false or triage: false, warn the user before proceeding. Items in those repos will fail at write time.
  2. Cache the repository_id (integer) for each repo now; you will need it in Phase 6:
gh api /repos/{owner}/{repo} --jq .id

Phase P4: Data Scan

  1. Fetch all project items using MCP. Important: for projects with more than ~200 items, gh api graphql --paginate is unreliable (it concatenates JSON responses without proper separators and can time out). Use the MCP tool which handles pagination internally, or use explicit cursor-based pagination:
# Preferred: use MCP tool (handles pagination automatically)
mcp__github__projects_list(owner: "{org}", project_number: {n}, method: "list_project_items")

# Fallback for large projects: manual cursor-based pagination
# Fetch 100 items per page, advancing the cursor each time.
# Process each page before fetching the next to avoid memory issues.
# Save progress (page number or last cursor) so you can resume if interrupted.
  1. For each item:
    • Skip if it is a draft item (not a real issue).
    • Extract the source project field value.
    • Skip if the source value is empty.
    • Check if the issue already has a value for the target issue field:
gh api /repos/{owner}/{repo}/issues/{number}/issue-field-values \
  -H "X-GitHub-Api-Version: 2026-03-10"
  • If the issue field already has a value, skip it (preserve existing data).
  1. Classify each item into one of:
    • Migrate: has source value, no existing target value
    • Skip (already set): target issue field already has a value
    • Skip (no source): project field is empty for this item
    • Skip (draft): item is a draft, not a real issue
    • Skip (unmapped option): single-select value was not mapped

Phase P5: Preview / Dry-Run

Present a summary before any writes.

If user requested dry-run: show the full detailed report (every issue, its current value, proposed new value, and skip reason) and stop. Do not execute.

Otherwise (preview mode): show summary counts and a sample of changes, then ask for confirmation.

Example preview:

Migration Preview for Project #42

Fields to migrate: Priority, Due Date

| Category               | Count |
|------------------------|-------|
| Items to migrate       |   847 |
| Already set (skip)     |    23 |
| No source value (skip) |   130 |
| Draft items (skip)     |    12 |
| Total project items    | 1,012 |

Sample changes (first 5):
  github/repo-a#101: Priority → "High"
  github/repo-a#203: Priority → "Medium", Due Date → "2025-03-15"
  github/repo-b#44:  Priority → "Low"
  github/repo-a#310: Due Date → "2025-04-01"
  github/repo-c#7:   Priority → "Critical"

Estimated time: ~127s (847 API calls at 0.15s each)

Proceed with migration? This will update 847 issues across 3 repositories.

Phase P6: Execution

  1. Use the repository_id values cached in Phase 3.

  2. For each item to migrate, write the issue field value:

echo '{"issue_field_values": [{"field_id": FIELD_ID, "value": "VALUE"}]}' | \
  gh api /repositories/{repo_id}/issues/{number}/issue-field-values \
    -X POST \
    -H "X-GitHub-Api-Version: 2026-03-10" \
    --input -

Replace FIELD_ID with the integer field ID (e.g., 1) and VALUE with the value string.

  1. Pacing: add a 100ms delay between API calls. On HTTP 429 responses, use exponential backoff (1s, 2s, 4s, up to 30s).
  2. Progress: report status every 25 items (e.g., "Migrated 75/847 items...").
  3. Error handling: log failures but continue processing remaining items.
  4. Final summary:
Migration Complete

| Result  | Count |
|---------|-------|
| Success |   842 |
| Skipped |   165 |
| Failed  |     5 |

Failed items:
  github/repo-a#501: 403 Forbidden (insufficient permissions)
  github/repo-b#88:  422 Validation failed (field not available on repo)
  ...

Important Notes

  • Write endpoint quirk: the REST API for writing issue field values uses repository_id (integer), not owner/repo. Always look up the repo ID first with gh api /repos/{owner}/{repo} --jq .id.
  • Single-select values: the REST API accepts option names as strings (not option IDs). This makes mapping straightforward for both project fields and labels.
  • Reading values back: when reading issue field values from the API response, use .single_select_option.name for the human-readable value. The .value property returns the internal option ID (an integer like 1201), not the display name.
  • API version header: all issue fields endpoints require X-GitHub-Api-Version: 2026-03-10.
  • Cross-repo items: a project can contain issues from multiple repositories. Cache the repo ID per-repository to avoid redundant lookups.
  • Preserve existing values: never overwrite an issue field value that is already set. Skip those items.
  • Iteration fields: have no issue field equivalent. Always warn the user and skip.
  • Draft items: project items that are not linked to real issues cannot have issue field values. Skip with a note.
  • Labels are repo-scoped: unlike project fields, labels exist per-repo. The same label name may exist in multiple repos; migration applies separately to each.
  • Label conflicts: an issue can have multiple labels that map to the same single_select field. Always detect and resolve these before execution.
  • Label removal is optional: after migration, the user may want to keep labels as backup or remove them. Always ask before removing.
  • URL-encode label names: labels with spaces or special characters must be URL-encoded when used in REST API paths (e.g., good%20first%20issue).
  • Script generation for scale: for migrations of 100+ issues, generate a standalone shell script rather than executing API calls one at a time through the agent. This is faster, resumable, and avoids agent timeout issues.
  • Idempotent migrations: re-running a migration is safe. Issues that already have the target field value set will be skipped. This means you can safely resume a partial migration without duplicating work.
  • --limit 1000 truncation: gh issue list --limit 1000 silently stops at 1000 results. For labels with more issues, paginate with --jq and cursor-based pagination or run multiple filtered queries (e.g., by date range).
  • macOS bash version: macOS ships with bash 3.x, which does not support declare -A (associative arrays). Generated scripts should use POSIX-compatible constructs or note the incompatibility and suggest brew install bash.
  • Issues vs PRs: gh issue list returns both issues and pull requests. If the migration should only target issues, include type in --json output and filter for type == "Issue".

Examples

Example 1: Full Migration

User: "I need to migrate Priority values from our project to the new org Priority issue field"

Action: Follow Phases P1-P6. Discover fields, map options, check permissions, scan items, preview, execute.

Example 2: Dry-Run Only

User: "Show me what would happen if I migrated fields from project #42, but don't actually do it"

Action: Follow Phases P1-P5 only. Present the full dry-run report with every item listed. Do not execute.

Example 3: Multiple Fields

User: "Migrate Priority and Due Date from project #15 to issue fields"

Action: Same workflow, but process both fields in a single pass. During the data scan, collect values for all mapped fields per item. Write all field values in a single API call per issue.

Example 4: Single Label to Issue Field

User: "I want to migrate the 'bug' label to the Type issue field"

Action: Route to Label Migration Flow. Ask for org/repo, list labels, confirm mapping: label "bug" → Type field "Bug" option. Scan issues with that label, preview, execute. Ask whether to remove the label after migration.

Example 5: Multiple Labels to One Field (Bulk)

User: "We have p0, p1, p2, p3 labels and want to convert them to the Priority issue field"

Action: Route to Label Migration Flow. Map all four labels to Priority field options (p0→P0, p1→P1, p2→P2, p3→P3). Check for conflicts (issues with multiple priority labels). Preview all changes in one summary. Execute in one pass. Optionally remove all four labels from migrated issues.

Example 6: Cross-Repo Label Migration with Label Removal

User: "Migrate the 'frontend' and 'backend' labels to the Team issue field across github/issues, github/memex, and github/mobile, then remove the old labels"

Action: Route to Label Migration Flow. Confirm repos and label mappings: "frontend"→Team "Frontend", "backend"→Team "Backend". Scan all three repos for issues with these labels. Detect conflicts (issues with both labels). Preview across repos. Execute field writes, then remove labels from migrated issues. Report per-repo stats.

发现问题?提交给管理员复核

评分:

评论 (0)

暂无评论,成为第一个评论者吧!