如何配置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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章