github-labels

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Labels

GitHub 标签管理

Reference for discovering and applying labels to GitHub PRs and issues.
为GitHub PR和Issue发现及应用标签的参考指南。

Discovering Available Labels

查看可用标签

bash
undefined
bash
undefined

List all labels with details

列出所有标签及详细信息

gh label list --json name,description,color --limit 50
gh label list --json name,description,color --limit 50

Search for specific labels

搜索特定标签

gh label list --search "bug"
gh label list --search "bug"

Output as simple list

输出为简单列表

gh label list --json name -q '.[].name'
undefined
gh label list --json name -q '.[].name'
undefined

Adding Labels to PRs

为PR添加标签

bash
undefined
bash
undefined

Single label

添加单个标签

gh pr create --label "bug"
gh pr create --label "bug"

Multiple labels (repeat flag)

添加多个标签(重复使用参数)

gh pr create --label "bug" --label "priority:high"
gh pr create --label "bug" --label "priority:high"

Comma-separated

逗号分隔添加多个标签

gh pr create --label "bug,priority:high"
gh pr create --label "bug,priority:high"

Add to existing PR

为已有PR添加标签

gh pr edit 123 --add-label "ready-for-review"
undefined
gh pr edit 123 --add-label "ready-for-review"
undefined

Adding Labels to Issues

为Issue添加标签

bash
undefined
bash
undefined

Create with labels

创建Issue时添加标签

gh issue create --label "bug,needs-triage"
gh issue create --label "bug,needs-triage"

Add to existing issue

为已有Issue添加标签

gh issue edit 123 --add-label "in-progress"
gh issue edit 123 --add-label "in-progress"

Remove label

移除标签

gh issue edit 123 --remove-label "needs-triage"
undefined
gh issue edit 123 --remove-label "needs-triage"
undefined

Common Label Categories

常见标签分类

CategoryExamples
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
分类示例
类型
bug
,
feature
,
enhancement
,
documentation
,
chore
优先级
priority:critical
,
priority:high
,
priority:medium
,
priority:low
状态
needs-triage
,
in-progress
,
blocked
,
ready-for-review
领域
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.
从Issue创建PR时:
  1. 通过
    gh issue view N --json labels
    查看Issue的标签
  2. 为PR应用相同标签:
    gh pr create --label "label1,label2"
这能保持可追溯性和分类一致性。