diff --git a/src/GitReleaseManager.Core/Provider/IVcsProvider.cs b/src/GitReleaseManager.Core/Provider/IVcsProvider.cs index 32616f38..21893b63 100644 --- a/src/GitReleaseManager.Core/Provider/IVcsProvider.cs +++ b/src/GitReleaseManager.Core/Provider/IVcsProvider.cs @@ -45,5 +45,7 @@ public interface IVcsProvider Task UpdateReleaseAsync(string owner, string repository, Release release); RateLimit GetRateLimit(); + + string GetMiletoneUrlQueryString(); } } \ No newline at end of file diff --git a/src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs b/src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs index 3f8c7d50..e3df9bcf 100644 --- a/src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs +++ b/src/GitReleaseManager.Core/ReleaseNotes/ReleaseNotesBuilder.cs @@ -68,6 +68,8 @@ public async Task BuildReleaseNotesAsync(string user, string repository, var issuesDict = GetIssuesDict(issues); + var milestoneUrlQueryString = _vcsProvider.GetMiletoneUrlQueryString(); + var templateModel = new { Issues = new @@ -84,6 +86,7 @@ public async Task BuildReleaseNotesAsync(string user, string repository, { Target = _targetMilestone, Previous = previousMilestone, + UrlQueryString = milestoneUrlQueryString, }, IssueLabels = issuesDict.Keys.ToList(), }; diff --git a/src/GitReleaseManager.Core/Templates/default/release-info.sbn b/src/GitReleaseManager.Core/Templates/default/release-info.sbn index 6a1084a5..1fbd615e 100644 --- a/src/GitReleaseManager.Core/Templates/default/release-info.sbn +++ b/src/GitReleaseManager.Core/Templates/default/release-info.sbn @@ -1,9 +1,9 @@ {{ if issues.count > 0 if commits.count > 0 -}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) being closed. +}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.url_query_string }}) being closed. {{ else -}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) closed. +}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.url_query_string }}) closed. {{ end else if commits.count > 0 }}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}). diff --git a/src/GitReleaseManager.Tests/ReleaseNotesBuilderTests.cs b/src/GitReleaseManager.Tests/ReleaseNotesBuilderTests.cs index 2591ba57..782ac037 100644 --- a/src/GitReleaseManager.Tests/ReleaseNotesBuilderTests.cs +++ b/src/GitReleaseManager.Tests/ReleaseNotesBuilderTests.cs @@ -237,6 +237,9 @@ private static void AcceptTest(int commits, Config config, Milestone milestone, vcsProvider.GetMilestonesAsync(owner, repository, Arg.Any()) .Returns(Task.FromResult((IEnumerable)vcsService.Milestones)); + vcsProvider.GetMiletoneUrlQueryString() + .Returns("closed=1"); + var builder = new ReleaseNotesBuilder(vcsProvider, logger, fileSystem, configuration, new TemplateFactory(fileSystem, configuration, TemplateKind.Create)); var notes = builder.BuildReleaseNotesAsync(owner, repository, milestone.Title, ReleaseTemplates.DEFAULT_NAME).Result;