fix: 🐛 attempt to fix the Duplication of PRs in Rrelease Draft

This commit is contained in:
Florian Beisel 2024-01-15 09:19:21 +01:00
parent 56650ff20f
commit d401e4c9ff
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
1 changed files with 11 additions and 5 deletions

View File

@ -53,13 +53,19 @@ func updateOrCreateDraftRelease(a *Action, cfg *config.RepoConfig) (*gitea.Relea
categorizedPRs := make(map[string][]*gitea.PullRequest) categorizedPRs := make(map[string][]*gitea.PullRequest)
for _, prs := range *changelog { for _, prs := range *changelog {
for _, category := range cfg.Categories { for _, pr := range prs {
if prHasLabel(prs, category.Labels) { categorized := false
// Correctly append each PR in the slice for _, category := range cfg.Categories {
for _, pr := range prs { if !categorized && prHasLabel(prs, category.Labels) {
categorizedPRs[category.Title] = append(categorizedPRs[category.Title], pr) categorizedPRs[category.Title] = append(categorizedPRs[category.Title], pr)
categorized = true
// Break after adding the PR to a category
break
} }
break }
if !categorized {
// Add to a default category if not categorized
categorizedPRs["Other Changes"] = append(categorizedPRs["Other Changes"], pr)
} }
} }
} }