Skip to content

Commit 5401ee2

Browse files
committed
chore: comment on resolved issues
1 parent e99a82a commit 5401ee2

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

build/Build.GitFlow.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ partial class Build
2323
[Parameter] readonly bool Major;
2424

2525
string MajorMinorPatchVersion => Major ? $"{GitVersion.Major + 1}.0.0" : GitVersion.MajorMinorPatch;
26+
string MilestoneTitle => $"v{MajorMinorPatchVersion}";
2627

2728
Target Milestone => _ => _
2829
.Unlisted()
2930
.OnlyWhenStatic(() => GitRepository.IsOnReleaseBranch() || GitRepository.IsOnHotfixBranch())
3031
.Executes(async () =>
3132
{
32-
var milestoneTitle = $"v{MajorMinorPatchVersion}";
33-
var milestone = await GitRepository.GetGitHubMilestone(milestoneTitle);
33+
var milestone = await GitRepository.GetGitHubMilestone(MilestoneTitle);
3434
if (milestone == null)
3535
return;
3636

build/Build.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Nuke.Common.ProjectModel;
1919
using Nuke.Common.Tooling;
2020
using Nuke.Common.Tools.DotNet;
21+
using Nuke.Common.Tools.GitHub;
2122
using Nuke.Common.Tools.GitVersion;
2223
using Nuke.Common.Utilities;
2324
using Nuke.Components;
@@ -178,7 +179,13 @@ void DeletePackage(string id, string version)
178179
.Inherit<ICreateGitHubRelease>()
179180
.TriggeredBy<IPublish>()
180181
.ProceedAfterFailure()
181-
.OnlyWhenStatic(() => GitRepository.IsOnMasterBranch());
182+
.OnlyWhenStatic(() => GitRepository.IsOnMasterBranch())
183+
.Executes(async () =>
184+
{
185+
var issues = await GitRepository.GetGitHubMilestoneIssues(MilestoneTitle);
186+
foreach (var issue in issues)
187+
await GitHubActions.Instance.CreateComment(issue.Number, $"Released in {MilestoneTitle}! 🎉");
188+
});
182189

183190
Target Install => _ => _
184191
.DependsOn<IPack>()

source/Nuke.Common/Tools/GitHub/GitHubTasks.cs

+10
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public static async Task<Milestone> GetGitHubMilestone(this GitRepository reposi
8484
return milestones.FirstOrDefault(x => x.Title == name);
8585
}
8686

87+
public static async Task<IReadOnlyList<Issue>> GetGitHubMilestoneIssues(this GitRepository repository, string name)
88+
{
89+
Assert.True(repository.IsGitHubRepository());
90+
var milestone = await repository.GetGitHubMilestone(name).NotNull();
91+
return await GitHubClient.Issue.GetAllForRepository(
92+
repository.GetGitHubOwner(),
93+
repository.GetGitHubName(),
94+
new RepositoryIssueRequest { State = ItemStateFilter.All, Milestone = milestone.Number.ToString() });
95+
}
96+
8797
public static async Task TryCreateGitHubMilestone(this GitRepository repository, string title)
8898
{
8999
try

0 commit comments

Comments
 (0)