gitlab-label

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Label Skill

标签技能

Label management operations for GitLab using the
glab
CLI.
使用
glab
CLI进行GitLab的标签管理操作。

Quick Reference

快速参考

OperationCommandRisk
List labels
glab label list
-
Create label
glab label create <name>
⚠️
Risk Legend: - Safe | ⚠️ Caution | ⚠️⚠️ Warning | ⚠️⚠️⚠️ Danger
操作命令风险
列出标签
glab label list
-
创建标签
glab label create <name>
⚠️
风险说明: - 安全 | ⚠️ 注意 | ⚠️⚠️ 警告 | ⚠️⚠️⚠️ 危险

When to Use This Skill

何时使用此技能

ALWAYS use when:
  • User wants to manage project labels
  • User mentions "label", "tag" (for categorization), "category"
  • User wants to organize issues or MRs
NEVER use when:
  • User wants to apply labels to issues/MRs (use gitlab-issue or gitlab-mr)
  • User wants to manage git tags (use git commands or gitlab-release)
务必在以下场景使用:
  • 用户需要管理项目标签
  • 用户提及"标签"、"标记"(用于分类)、"类别"
  • 用户需要整理议题(Issue)或合并请求(MR)
切勿在以下场景使用:
  • 用户需要为议题/合并请求添加标签(使用gitlab-issue或gitlab-mr技能)
  • 用户需要管理Git标签(使用Git命令或gitlab-release技能)

Available Commands

可用命令

List Labels

列出标签

bash
glab label list [options]
Options:
FlagDescription
-P, --per-page=<n>
Results per page
--all
Get all labels
Examples:
bash
undefined
bash
glab label list [options]
选项:
标记描述
-P, --per-page=<n>
每页结果数量
--all
获取所有标签
示例:
bash
undefined

List all project labels

列出所有项目标签

glab label list
glab label list

List with more results

列出更多结果

glab label list --per-page=100
undefined
glab label list --per-page=100
undefined

Create Label

创建标签

bash
glab label create <name> [options]
Options:
FlagDescription
-c, --color=<color>
Label color (hex format, e.g., #ff0000)
-d, --description=<desc>
Label description
Examples:
bash
undefined
bash
glab label create <name> [options]
选项:
标记描述
-c, --color=<color>
标签颜色(十六进制格式,例如:#ff0000)
-d, --description=<desc>
标签描述
示例:
bash
undefined

Create label with default color

创建默认颜色的标签

glab label create "needs-review"
glab label create "needs-review"

Create label with color

创建带颜色的标签

glab label create "bug" -c "#ff0000"
glab label create "bug" -c "#ff0000"

Create label with color and description

创建带颜色和描述的标签

glab label create "priority::high"
-c "#dc3545"
-d "High priority items requiring immediate attention"
glab label create "priority::high"
-c "#dc3545"
-d "需要立即处理的高优先级事项"

Create scoped label

创建范围标签

glab label create "status::in-progress"
-c "#ffc107"
-d "Work in progress"
undefined
glab label create "status::in-progress"
-c "#ffc107"
-d "进行中工作"
undefined

Common Label Patterns

常见标签模式

Priority Labels

优先级标签

bash
glab label create "priority::critical" -c "#dc3545" -d "Must fix immediately"
glab label create "priority::high" -c "#fd7e14" -d "Fix in current sprint"
glab label create "priority::medium" -c "#ffc107" -d "Fix soon"
glab label create "priority::low" -c "#28a745" -d "Nice to have"
bash
glab label create "priority::critical" -c "#dc3545" -d "必须立即修复"
glab label create "priority::high" -c "#fd7e14" -d "当前迭代修复"
glab label create "priority::medium" -c "#ffc107" -d "尽快修复"
glab label create "priority::low" -c "#28a745" -d "锦上添花的功能"

Type Labels

类型标签

bash
glab label create "type::bug" -c "#d73a4a" -d "Something isn't working"
glab label create "type::feature" -c "#0366d6" -d "New feature request"
glab label create "type::docs" -c "#0075ca" -d "Documentation"
glab label create "type::refactor" -c "#6f42c1" -d "Code refactoring"
bash
glab label create "type::bug" -c "#d73a4a" -d "功能异常"
glab label create "type::feature" -c "#0366d6" -d "新功能需求"
glab label create "type::docs" -c "#0075ca" -d "文档相关"
glab label create "type::refactor" -c "#6f42c1" -d "代码重构"

Status Labels

状态标签

bash
glab label create "status::backlog" -c "#6c757d" -d "In backlog"
glab label create "status::ready" -c "#17a2b8" -d "Ready to start"
glab label create "status::in-progress" -c "#ffc107" -d "Work in progress"
glab label create "status::review" -c "#007bff" -d "In review"
glab label create "status::done" -c "#28a745" -d "Completed"
bash
glab label create "status::backlog" -c "#6c757d" -d "待办事项"
glab label create "status::ready" -c "#17a2b8" -d "准备开始"
glab label create "status::in-progress" -c "#ffc107" -d "进行中"
glab label create "status::review" -c "#007bff" -d "审核中"
glab label create "status::done" -c "#28a745" -d "已完成"

Workflow Labels

工作流标签

bash
glab label create "needs-review" -c "#d876e3" -d "Needs code review"
glab label create "needs-design" -c "#fbca04" -d "Needs design input"
glab label create "blocked" -c "#b60205" -d "Blocked by external dependency"
glab label create "help-wanted" -c "#008672" -d "Looking for contributors"
bash
glab label create "needs-review" -c "#d876e3" -d "需要代码审核"
glab label create "needs-design" -c "#fbca04" -d "需要设计输入"
glab label create "blocked" -c "#b60205" -d "被外部依赖阻塞"
glab label create "help-wanted" -c "#008672" -d "寻求贡献者"

GitLab Scoped Labels

GitLab 范围标签

GitLab supports scoped labels using the
::
separator:
priority::high
status::in-progress
type::bug
Only one label per scope can be applied to an issue/MR, making them mutually exclusive.
GitLab支持使用
::
分隔符的范围标签:
priority::high
status::in-progress
type::bug
每个范围只能有一个标签应用到议题/合并请求,使其互斥。

Common Workflows

常见工作流

Workflow 1: Set Up New Project Labels

工作流1:设置新项目标签

bash
undefined
bash
undefined

Create priority labels

创建优先级标签

glab label create "priority::critical" -c "#dc3545" glab label create "priority::high" -c "#fd7e14" glab label create "priority::medium" -c "#ffc107" glab label create "priority::low" -c "#28a745"
glab label create "priority::critical" -c "#dc3545" glab label create "priority::high" -c "#fd7e14" glab label create "priority::medium" -c "#ffc107" glab label create "priority::low" -c "#28a745"

Create type labels

创建类型标签

glab label create "type::bug" -c "#d73a4a" glab label create "type::feature" -c "#0366d6" glab label create "type::docs" -c "#0075ca"
undefined
glab label create "type::bug" -c "#d73a4a" glab label create "type::feature" -c "#0366d6" glab label create "type::docs" -c "#0075ca"
undefined

Workflow 2: Apply Labels to Issues

工作流2:为议题添加标签

bash
undefined
bash
undefined

List available labels

列出可用标签

glab label list
glab label list

Create issue with labels

创建带标签的议题

glab issue create -t "Fix login bug" -l "type::bug,priority::high"
glab issue create -t "修复登录bug" -l "type::bug,priority::high"

Update issue labels

更新议题标签

glab issue update 42 -l "status::in-progress"
undefined
glab issue update 42 -l "status::in-progress"
undefined

Color Reference

颜色参考

Common colors for labels:
ColorHexUse For
Red
#dc3545
Bugs, critical, blocked
Orange
#fd7e14
High priority, warning
Yellow
#ffc107
Medium priority, in-progress
Green
#28a745
Done, low priority, good first issue
Blue
#007bff
Features, info, review
Purple
#6f42c1
Refactor, enhancement
Gray
#6c757d
Backlog, wontfix
标签常用颜色:
颜色十六进制用途
红色
#dc3545
Bug、严重问题、阻塞
橙色
#fd7e14
高优先级、警告
黄色
#ffc107
中优先级、进行中
绿色
#28a745
已完成、低优先级、新手友好任务
蓝色
#007bff
功能、信息、审核
紫色
#6f42c1
重构、增强
灰色
#6c757d
待办、不会修复

Troubleshooting

故障排除

IssueCauseSolution
Authentication failedInvalid/expired tokenRun
glab auth login
Label already existsDuplicate nameUse different name or update existing
Invalid colorWrong formatUse hex format: #RRGGBB
Permission deniedNot maintainerNeed maintainer+ role
问题原因解决方法
认证失败令牌无效/过期运行
glab auth login
标签已存在名称重复使用不同名称或更新现有标签
无效颜色格式错误使用十六进制格式:#RRGGBB
权限不足不是维护者需要维护者及以上角色

Related Documentation

相关文档

  • Safeguards
  • Quick Reference
  • 安全防护
  • 快速参考