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 {