1. 程式人生 > >如何配置gitlab自動生成哪些label

如何配置gitlab自動生成哪些label

1. 問題

gitlab 中 some-project > Issues > Labels > “Generate a default set of labels”

點選可以生成一系列的label

如何自定義這些 labels 呢?

2. 解決

  1. 修改 gitlab/lib/gitlab/issues_labels.rb
    在 labels 數組裡面新增就好拉!

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    module Gitlab
      class
    IssuesLabels class << self def generate(project) red = '#d9534f' yellow = '#f0ad4e' blue = '#428bca' green = '#5cb85c' labels = [ { title: "bug", color: red }, { title: "critical", color: red }, { title: "confirmed"
    , color: red }, { title: "documentation", color: yellow }, { title: "support", color: yellow }, { title: "discussion", color: blue }, { title: "suggestion", color: blue }, { title: "enhancement", color: green }, # 新增 {
    title: "Doing", color: green }, { title: "To Do", color: yellow }, { title: "Story", color: "#428BCA", description: "scrume story,新功能" }, { title: "No-Bug", color: "#D10069", description: "測試搞錯,非Bug" }, { title: "對外介面", color: "#5CB85C" } ] labels.each do |params| ::Labels::FindOrCreateService.new(nil, project, params).execute(skip_authorization: true) end end end end end
  2. 重啟 gitlab,service gitlab restart