fix: 添加缺失的tagIDs和parseLabel定义到batch.go

This commit is contained in:
狗gogo 2026-06-02 07:19:37 +08:00
parent 863e3e512a
commit 50c6882a60
1 changed files with 26 additions and 0 deletions

View File

@ -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 {