Compare commits

...

2 Commits

1 changed files with 10 additions and 10 deletions

View File

@ -56,17 +56,19 @@ func updateOrCreateDraftRelease(a *Action, cfg *config.RepoConfig) (*gitea.Relea
for _, pr := range prs { for _, pr := range prs {
categorized := false categorized := false
for _, category := range cfg.Categories { for _, category := range cfg.Categories {
if !categorized && prHasLabel(prs, category.Labels) { if !categorized && prHasLabel(pr, category.Labels) {
categorizedPRs[category.Title] = append(categorizedPRs[category.Title], pr) categorizedPRs[category.Title] = append(categorizedPRs[category.Title], pr)
categorized = true categorized = true
// Break after adding the PR to a category break // Break out of the category loop
break
} }
} }
if !categorized { if !categorized {
// Add to a default category if not categorized // Add to a default category if not categorized
categorizedPRs["Other Changes"] = append(categorizedPRs["Other Changes"], pr) categorizedPRs["Other Changes"] = append(categorizedPRs["Other Changes"], pr)
} }
if categorized {
break // Break out of the PR loop once categorized
}
} }
} }
@ -165,13 +167,11 @@ func (a *Action) Run() error {
return nil return nil
} }
func prHasLabel(prs []*gitea.PullRequest, labels []string) bool { func prHasLabel(pr *gitea.PullRequest, labels []string) bool {
for _, pr := range prs { for _, prLabel := range pr.Labels {
for _, prLabel := range pr.Labels { for _, label := range labels {
for _, label := range labels { if prLabel.Name == label {
if prLabel.Name == label { return true
return true
}
} }
} }
} }