Files
awesome-copilot/skills/issue-fields-migration/references/projects-api.md
Tadas Labudis af09f9c38e New skill: issue-fields-migration (#990)
* Add issue-fields-migration skill

Standalone skill to bulk-copy field values from Project V2 fields to
org-level issue fields. Includes 5-phase workflow (discovery, option
mapping, data scan, preview/dry-run, execution) with API references
for issue fields REST API and Projects V2 API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Expand issue-fields-migration skill to support label migration

Add support for migrating repo-based labels to org-level issue fields,
in addition to the existing project field migration flow.

Changes:
- Add Step 0 routing: ask user if migrating labels or project fields
- Add Label Migration Flow (Phases L1-L5) with conflict detection,
  bulk mapping, and optional label removal
- Add labels API to Available Tools table
- Create references/labels-api.md
- Add 3 label migration examples (single, bulk, cross-repo)
- Expand Important Notes with label-specific guidance
- Rename existing phases to P1-P6 under Project Field Migration Flow
- Include P1 fixes from prior work (proxy field filtering, batch
  option mapping, preflight permission checks, pagination fixes)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: payload format, field_id type + 10 UX/scale improvements

Bug fixes:
- Wrap write endpoint payload in {"issue_field_values": [...]} (was bare array)
- Use integer field_id, not string (both Phase L5 and P6)

UX improvements:
- Label filtering guidance for repos with 50+ labels
- Smarter auto-suggest with 4 pattern tiers (exact, prefix-number, strip-separators, substring)
- Handle zero-issue labels gracefully (stop and suggest alternatives)
- Add time estimates to migration previews
- Document read response shape (.single_select_option.name vs .value)

Scale & reliability:
- Script generation guidance for 100+ issue migrations
- Idempotent/resumable migration note
- Warn about --limit 1000 silent truncation
- Warn about macOS bash 3.x (no declare -A)
- PR filtering guidance (type field)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update README.skills.md with build

Regenerated skills index to reflect label migration support and
updated references for issue-fields-migration skill.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review comments: fix MCP conventions, step numbering, pagination, phase refs

- Align MCP tool calls with repo conventions (method: instead of action:,
  owner: instead of project_owner:) in SKILL.md and projects-api.md
- Fix step numbering in Phase P2 (duplicate step 5 → renumber to 6)
- Update example phase references to use P1-P6/P1-P5 labels
- Add pageInfo pagination to GraphQL fields and fieldValues queries
- Fix MCP tool name in labels-api.md to mcp__github__list_issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 09:42:14 +11:00

3.4 KiB

Projects V2 API Reference (for Migration)

This reference covers the subset of the Projects V2 API needed for field migration: discovering project fields and reading item values.

List Project Fields

Via MCP Tool

mcp__github__projects_list(
  owner: "{org}",
  project_number: {n},
  method: "list_project_fields"
)

Via GraphQL

gh api graphql -f query='
  query {
    organization(login: "ORG") {
      projectV2(number: N) {
        fields(first: 30) {
          pageInfo { hasNextPage endCursor }
          nodes {
            ... on ProjectV2Field {
              id
              name
              dataType
            }
            ... on ProjectV2SingleSelectField {
              id
              name
              dataType
              options { id name }
            }
            ... on ProjectV2IterationField {
              id
              name
              dataType
            }
          }
        }
      }
    }
  }'

Field Data Types

dataType Description Migrates to
TEXT Free-form text text issue field
SINGLE_SELECT Dropdown with options single_select issue field
NUMBER Numeric value number issue field
DATE Date value date issue field
ITERATION Sprint/iteration cycles No equivalent (skip)

List Project Items (with field values)

Via MCP Tool

mcp__github__projects_list(
  owner: "{org}",
  project_number: {n},
  method: "list_project_items"
)

Returns paginated results. Each item includes:

  • Item type (ISSUE, DRAFT_ISSUE, PULL_REQUEST)
  • Content reference (repo owner, repo name, issue number)
  • Field values for all project fields

Via GraphQL

gh api graphql -f query='
  query($cursor: String) {
    organization(login: "ORG") {
      projectV2(number: N) {
        items(first: 100, after: $cursor) {
          pageInfo { hasNextPage endCursor }
          nodes {
            type
            content {
              ... on Issue {
                number
                repository { nameWithOwner }
              }
            }
            fieldValues(first: 20) {
              pageInfo { hasNextPage endCursor }
              nodes {
                ... on ProjectV2ItemFieldTextValue { text field { ... on ProjectV2Field { name } } }
                ... on ProjectV2ItemFieldSingleSelectValue { name field { ... on ProjectV2SingleSelectField { name } } }
                ... on ProjectV2ItemFieldNumberValue { number field { ... on ProjectV2Field { name } } }
                ... on ProjectV2ItemFieldDateValue { date field { ... on ProjectV2Field { name } } }
              }
            }
          }
        }
      }
    }
  }' -f cursor="$CURSOR"

Important Notes for Migration

  • Pagination: projects can have up to 10,000 items. Always paginate using pageInfo.hasNextPage and pageInfo.endCursor.
  • Draft items: items with type: DRAFT_ISSUE have no real issue attached. Skip these during migration.
  • Pull requests: items with type: PULL_REQUEST are PRs, not issues. Issue fields apply to issues only. Skip these.
  • Cross-repo: a single project can contain issues from many repositories. Group items by repo to batch repo ID lookups.
  • Field value access: each field value node type is different (ProjectV2ItemFieldTextValue, ProjectV2ItemFieldSingleSelectValue, etc.). Handle each type.