Files
awesome-copilot/skills/issue-fields-migration/references/labels-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

2.1 KiB

Labels API Reference

Reference for GitHub Labels REST API endpoints used in the label migration flow.

List Labels in a Repository

GET /repos/{owner}/{repo}/labels

Returns all labels defined on a repository. Paginated (max 100 per page).

CLI shortcut:

gh label list -R {owner}/{repo} --limit 1000 --json name,color,description

Response fields: id, node_id, url, name, description, color, default.

List Issues by Label

GET /repos/{owner}/{repo}/issues?labels={label_name}&state=all&per_page=100

Returns issues (and pull requests) matching the label. Filter out PRs by checking pull_request field is absent.

CLI shortcut:

gh issue list -R {owner}/{repo} --label "{label_name}" --state all \
  --json number,title,labels --limit 1000

The gh issue list command automatically excludes PRs.

Pagination: use --limit in CLI or page query param in REST. For repos with >1000 matching issues, use cursor-based pagination via Link headers.

Remove a Label from an Issue

DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{label_name}

Removes a single label from an issue. Returns 200 OK with the remaining labels on the issue.

Important: URL-encode label names with spaces or special characters:

  • good first issuegood%20first%20issue
  • bug/criticalbug%2Fcritical

CLI shortcut:

gh api /repos/{owner}/{repo}/issues/{number}/labels/{label_name} -X DELETE

Add a Label to an Issue

POST /repos/{owner}/{repo}/issues/{issue_number}/labels

Body: {"labels": ["label1", "label2"]}

Not typically needed for migration, but useful for rollback scenarios.

Notes

  • Labels are repo-scoped. The same label name can exist independently in different repos.
  • There is no MCP tool for listing repo labels. Use gh label list or the REST API.
  • The MCP tool mcp__github__list_issues supports a labels filter for fetching issues by label.
  • Label names are case-insensitive for matching purposes, but the API preserves the original casing.
  • Maximum labels per issue: no hard limit, but practically dozens.