From 182aed4bfbb63dc66f7ebed25dc8a137ae8ae633 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 10 Jan 2025 14:33:49 -0600 Subject: [PATCH] yaml support --- modules/label/label.go | 9 +++++---- modules/repository/init.go | 9 +++++---- options/label/Advanced.yaml | 11 +++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/label/label.go b/modules/label/label.go index d3ef0e1dc9..ce028aa9f3 100644 --- a/modules/label/label.go +++ b/modules/label/label.go @@ -14,10 +14,11 @@ var colorPattern = regexp.MustCompile("^#?(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})$") // Label represents label information loaded from template type Label struct { - Name string `yaml:"name"` - Color string `yaml:"color"` - Description string `yaml:"description,omitempty"` - Exclusive bool `yaml:"exclusive,omitempty"` + Name string `yaml:"name"` + Color string `yaml:"color"` + Description string `yaml:"description,omitempty"` + Exclusive bool `yaml:"exclusive,omitempty"` + ExclusiveOrder int `yaml:"exclusive_order,omitempty"` } // NormalizeColor normalizes a color string to a 6-character hex code diff --git a/modules/repository/init.go b/modules/repository/init.go index 24602ae090..097dd596e5 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -154,10 +154,11 @@ func InitializeLabels(ctx context.Context, id int64, labelTemplate string, isOrg labels := make([]*issues_model.Label, len(list)) for i := 0; i < len(list); i++ { labels[i] = &issues_model.Label{ - Name: list[i].Name, - Exclusive: list[i].Exclusive, - Description: list[i].Description, - Color: list[i].Color, + Name: list[i].Name, + Exclusive: list[i].Exclusive, + ExclusiveOrder: list[i].ExclusiveOrder, + Description: list[i].Description, + Color: list[i].Color, } if isOrg { labels[i].OrgID = id diff --git a/options/label/Advanced.yaml b/options/label/Advanced.yaml index b1ecdd6d93..55ac91116e 100644 --- a/options/label/Advanced.yaml +++ b/options/label/Advanced.yaml @@ -22,49 +22,60 @@ labels: description: Breaking change that won't be backward compatible - name: "Reviewed/Duplicate" exclusive: true + exclusive_order: 50 color: 616161 description: This issue or pull request already exists - name: "Reviewed/Invalid" exclusive: true + exclusive_order: 100 color: 546e7a description: Invalid issue - name: "Reviewed/Confirmed" exclusive: true + exclusive_order: 0 color: 795548 description: Issue has been confirmed - name: "Reviewed/Won't Fix" exclusive: true + exclusive_order: 75 color: eeeeee description: This issue won't be fixed - name: "Status/Need More Info" exclusive: true + exclusive_order: 25 color: 424242 description: Feedback is required to reproduce issue or to continue work - name: "Status/Blocked" exclusive: true + exclusive_order: 0 color: 880e4f description: Something is blocking this issue or pull request - name: "Status/Abandoned" exclusive: true + exclusive_order: 100 color: "222222" description: Somebody has started to work on this but abandoned work - name: "Priority/Critical" exclusive: true + exclusive_order: 0 color: b71c1c description: The priority is critical priority: critical - name: "Priority/High" exclusive: true + exclusive_order: 1 color: d32f2f description: The priority is high priority: high - name: "Priority/Medium" exclusive: true + exclusive_order: 2 color: e64a19 description: The priority is medium priority: medium - name: "Priority/Low" exclusive: true + exclusive_order: 3 color: 4caf50 description: The priority is low priority: low