返回 Skill 列表
extension
分类: 开发与工程无需 API Key

github-labels

使用gh CLI发现并应用标签到GitHub PR和问题上。当您需要列出可用标签、在拉取请求或问题上添加或移除标签,或者为仓库创建新标签时,请使用此功能。

person作者: jakexiaohubgithub

GitHub Labels

Reference for discovering and applying labels to GitHub PRs and issues.

Discovering Available Labels

# List all labels with details
gh label list --json name,description,color --limit 50

# Search for specific labels
gh label list --search "bug"

# Output as simple list
gh label list --json name -q '.[].name'

Adding Labels to PRs

# Single label
gh pr create --label "bug"

# Multiple labels (repeat flag)
gh pr create --label "bug" --label "priority:high"

# Comma-separated
gh pr create --label "bug,priority:high"

# Add to existing PR
gh pr edit 123 --add-label "ready-for-review"

Adding Labels to Issues

# Create with labels
gh issue create --label "bug,needs-triage"

# Add to existing issue
gh issue edit 123 --add-label "in-progress"

# Remove label
gh issue edit 123 --remove-label "needs-triage"

Common Label Categories

| Category | Examples | |----------|----------| | Type | bug, feature, enhancement, documentation, chore | | Priority | priority:critical, priority:high, priority:medium, priority:low | | Status | needs-triage, in-progress, blocked, ready-for-review | | Area | frontend, backend, infrastructure, testing, ci-cd |

Label Inheritance Pattern

When creating a PR from an issue:

  1. Read issue labels via gh issue view N --json labels
  2. Apply same labels to PR: gh pr create --label "label1,label2"

This maintains traceability and consistent categorization.