Skip to content

Commit da5dee3

Browse files
committed
Fix the issue where contributors associated with filtered-out issues were included in release notes
1 parent 0e8ca36 commit da5dee3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Threading.Tasks;
66
using GitReleaseManager.Core.Configuration;
77
using GitReleaseManager.Core.Exceptions;
8-
using GitReleaseManager.Core.Extensions;
98
using GitReleaseManager.Core.Helpers;
109
using GitReleaseManager.Core.Model;
1110
using GitReleaseManager.Core.Provider;
@@ -68,19 +67,15 @@ public async Task<string> BuildReleaseNotesAsync(string user, string repository,
6867
var commitsLink = _vcsProvider.GetCommitsUrl(_user, _repository, _targetMilestone?.Title, previousMilestone?.Title);
6968

7069
var issuesDict = GetIssuesDict(issues);
70+
var distinctValidIssues = issuesDict.SelectMany(kvp => kvp.Value).DistinctBy(i => i.PublicNumber);
7171

72-
// The call to GetIssuesDict above will filter out the issues that are not taged with one of the configured tags.
73-
// Therefore it's more efficient to fetch the linked issues AFTER GetIssuesDict has been invoked.
74-
foreach (var kvp in issuesDict)
72+
foreach (var issue in distinctValidIssues)
7573
{
76-
foreach (var issue in kvp.Value)
77-
{
78-
var linkedIssues = await _vcsProvider.GetLinkedIssuesAsync(_user, _repository, issue).ConfigureAwait(false);
79-
issue.LinkedIssues = linkedIssues?.ToList().AsReadOnly() ?? Array.AsReadOnly(Array.Empty<Issue>());
80-
}
74+
var linkedIssues = await _vcsProvider.GetLinkedIssuesAsync(_user, _repository, issue).ConfigureAwait(false);
75+
issue.LinkedIssues = linkedIssues?.ToList().AsReadOnly() ?? Array.AsReadOnly(Array.Empty<Issue>());
8176
}
8277

83-
var contributors = GetContributors(issues);
78+
var contributors = GetContributors(distinctValidIssues);
8479

8580
var milestoneQueryString = _vcsProvider.GetMilestoneQueryString();
8681

0 commit comments

Comments
 (0)