File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
source/Nuke.Common/Tools/GitHub Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 1818using Nuke . Common . ProjectModel ;
1919using Nuke . Common . Tooling ;
2020using Nuke . Common . Tools . DotNet ;
21+ using Nuke . Common . Tools . GitHub ;
2122using Nuke . Common . Tools . GitVersion ;
2223using Nuke . Common . Utilities ;
2324using 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 > ( )
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments