|
5 | 5 | using System.Threading.Tasks; |
6 | 6 | using GitReleaseManager.Core.Configuration; |
7 | 7 | using GitReleaseManager.Core.Exceptions; |
8 | | -using GitReleaseManager.Core.Extensions; |
9 | 8 | using GitReleaseManager.Core.Helpers; |
10 | 9 | using GitReleaseManager.Core.Model; |
11 | 10 | using GitReleaseManager.Core.Provider; |
@@ -68,19 +67,15 @@ public async Task<string> BuildReleaseNotesAsync(string user, string repository, |
68 | 67 | var commitsLink = _vcsProvider.GetCommitsUrl(_user, _repository, _targetMilestone?.Title, previousMilestone?.Title); |
69 | 68 |
|
70 | 69 | var issuesDict = GetIssuesDict(issues); |
| 70 | + var distinctValidIssues = issuesDict.SelectMany(kvp => kvp.Value).DistinctBy(i => i.PublicNumber); |
71 | 71 |
|
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) |
75 | 73 | { |
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>()); |
81 | 76 | } |
82 | 77 |
|
83 | | - var contributors = GetContributors(issues); |
| 78 | + var contributors = GetContributors(distinctValidIssues); |
84 | 79 |
|
85 | 80 | var milestoneQueryString = _vcsProvider.GetMilestoneQueryString(); |
86 | 81 |
|
|
0 commit comments