From 50c6882a601a9cf6299804f9302e996bbfdf6032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=97gogo?= Date: Tue, 2 Jun 2026 07:19:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=9A=84tagIDs=E5=92=8CparseLabel=E5=AE=9A=E4=B9=89=E5=88=B0ba?= =?UTF-8?q?tch.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shortcuts/issue/batch.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/shortcuts/issue/batch.go b/shortcuts/issue/batch.go index 2fef7ea8..ea4e4420 100644 --- a/shortcuts/issue/batch.go +++ b/shortcuts/issue/batch.go @@ -63,6 +63,21 @@ var trackerNames = map[int]string{ trackerQuestion: "question", } +// Tag name → GitLink tag ID mapping +// Collect IDs from web UI DevTools: change tag → capture PATCH payload → get issue_tag_ids value +var tagIDs = map[string]int{ + "缺陷": 315526, + "功能": 315527, + "文档": 315533, + "重复": 315525, + "疑问": 315528, + "支持": 315529, + "任务": 315530, + "测试": 315534, + "协助": 315531, + "搁置": 315532, +} + // BatchResult is a single item result in a batch operation. type BatchResult struct { Number string `json:"number" yaml:"number"` @@ -551,6 +566,17 @@ func parseTracker(label string) (int, error) { } } +// parseLabel converts a label name to its GitLink tag ID +func parseLabel(name string) (int, error) { + if id, ok := tagIDs[name]; ok && id != 0 { + return id, nil + } + if id, err := strconv.Atoi(name); err == nil { + return id, nil + } + return 0, fmt.Errorf("invalid label %q: not found in tagIDs mapping", name) +} + func collectIssueNumbers(numbersValue, csvPath string) ([]string, error) { numbers, err := parseIssueNumbers(numbersValue) if err != nil {