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 {
categorized := false
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)
categorized = true
// Break after adding the PR to a category
break
break // Break out of the category loop
}
}
if !categorized {
// Add to a default category if not categorized
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
}
func prHasLabel(prs []*gitea.PullRequest, labels []string) bool {
for _, pr := range prs {
for _, prLabel := range pr.Labels {
for _, label := range labels {
if prLabel.Name == label {
return true
}
func prHasLabel(pr *gitea.PullRequest, labels []string) bool {
for _, prLabel := range pr.Labels {
for _, label := range labels {
if prLabel.Name == label {
return true
}
}
}