diff --git a/build/Build.Announce.cs b/build/Build.Announce.cs index c3a09433f..b3f8c1b96 100644 --- a/build/Build.Announce.cs +++ b/build/Build.Announce.cs @@ -71,11 +71,9 @@ partial class Build } IEnumerable<(string Text, string Url)> AnnouncementSponsors => - new (string Text, string Url)[] - { - ("Octopus Deploy", "https://octopus.com/"), - ("Amazon Web Services", "https://aws.amazon.com/"), - }; + [ + ("Octopus Deploy", "https://octopus.com/") + ]; // https://api.slack.com/apps/A050ZLH0V40/incoming-webhooks? [Parameter] [Secret] readonly string SlackWebhook; diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentTrigger.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentTrigger.cs new file mode 100644 index 000000000..13a9032a5 --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentTrigger.cs @@ -0,0 +1,26 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using System.Linq; +using JetBrains.Annotations; +using Nuke.Common.Tooling; +using Nuke.Common.Utilities; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +[PublicAPI] +public class GitHubActionsIssueCommentTrigger : GitHubActionsDetailedTrigger +{ + public GitHubActionsIssueCommentType[] Types { get; set; } + + public override void Write(CustomFileWriter writer) + { + writer.WriteLine("issue_comment:"); + using (writer.Indent()) + { + if (Types.Length > 0) + writer.WriteLine($"types: [{Types.Select(x => x.GetValue()).JoinCommaSpace()}]"); + } + } +} diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentType.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentType.cs new file mode 100644 index 000000000..dfd615caa --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueCommentType.cs @@ -0,0 +1,14 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using Nuke.Common.Tooling; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +public enum GitHubActionsIssueCommentType +{ + [EnumValue("created")] Created, + [EnumValue("edited")] Edited, + [EnumValue("deleted")] Deleted +} diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueTrigger.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueTrigger.cs new file mode 100644 index 000000000..f1856fae3 --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueTrigger.cs @@ -0,0 +1,26 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using System.Linq; +using JetBrains.Annotations; +using Nuke.Common.Tooling; +using Nuke.Common.Utilities; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +[PublicAPI] +public class GitHubActionsIssueTrigger : GitHubActionsDetailedTrigger +{ + public GitHubActionsIssueType[] Types { get; set; } + + public override void Write(CustomFileWriter writer) + { + writer.WriteLine("issues:"); + using (writer.Indent()) + { + if (Types.Length > 0) + writer.WriteLine($"types: [{Types.Select(x => x.GetValue()).JoinCommaSpace()}]"); + } + } +} diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueType.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueType.cs new file mode 100644 index 000000000..d6ed83746 --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsIssueType.cs @@ -0,0 +1,58 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using Nuke.Common.Tooling; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +public enum GitHubActionsIssueType +{ + [EnumValue("opened")] + Opened, + + [EnumValue("edited")] + Edited, + + [EnumValue("deleted")] + Deleted, + + [EnumValue("transferred")] + Transferred, + + [EnumValue("pinned")] + Pinned, + + [EnumValue("unpinned")] + Unpinned, + + [EnumValue("closed")] + Closed, + + [EnumValue("reopened")] + Reopened, + + [EnumValue("assigned")] + Assigned, + + [EnumValue("unassigned")] + Unassigned, + + [EnumValue("labeled")] + Labeled, + + [EnumValue("unlabeled")] + Unlabeled, + + [EnumValue("locked")] + Locked, + + [EnumValue("unlocked")] + Unlocked, + + [EnumValue("milestoned")] + Milestoned, + + [EnumValue("demilestoned")] + Demilestoned +} diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelTrigger.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelTrigger.cs new file mode 100644 index 000000000..59eb5abc7 --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelTrigger.cs @@ -0,0 +1,26 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using System.Linq; +using JetBrains.Annotations; +using Nuke.Common.Tooling; +using Nuke.Common.Utilities; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +[PublicAPI] +public class GitHubActionsLabelTrigger : GitHubActionsDetailedTrigger +{ + public GitHubActionsLabelType[] Types { get; set; } + + public override void Write(CustomFileWriter writer) + { + writer.WriteLine("label:"); + using (writer.Indent()) + { + if (Types.Length > 0) + writer.WriteLine($"types: [{Types.Select(x => x.GetValue()).JoinCommaSpace()}]"); + } + } +} diff --git a/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelType.cs b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelType.cs new file mode 100644 index 000000000..c7c2587d7 --- /dev/null +++ b/source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsLabelType.cs @@ -0,0 +1,14 @@ +// Copyright 2023 Maintainers of NUKE. +// Distributed under the MIT License. +// https://github.com/nuke-build/nuke/blob/master/LICENSE + +using Nuke.Common.Tooling; + +namespace Nuke.Common.CI.GitHubActions.Configuration; + +public enum GitHubActionsLabelType +{ + [EnumValue("created")] Created, + [EnumValue("edited")] Edited, + [EnumValue("deleted")] Deleted +} diff --git a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs index 2c1f1599e..b5508dba4 100644 --- a/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs +++ b/source/Nuke.Common/CI/GitHubActions/GitHubActionsAttribute.cs @@ -61,8 +61,11 @@ public GitHubActionsAttribute( public string[] OnPullRequestExcludePaths { get; set; } = new string[0]; public string[] OnWorkflowDispatchOptionalInputs { get; set; } = new string[0]; public string[] OnWorkflowDispatchRequiredInputs { get; set; } = new string[0]; + public GitHubActionsIssueCommentType[] OnIssueCommentTypes {get; set;} = new GitHubActionsIssueCommentType[0]; + public GitHubActionsIssueType[] OnIssueTypes {get; set;} = new GitHubActionsIssueType[0]; + public GitHubActionsLabelType[] OnLabelTypes {get; set;} = new GitHubActionsLabelType[0]; public string OnCronSchedule { get; set; } - + public string[] ImportSecrets { get; set; } = new string[0]; public bool EnableGitHubToken { get; set; } public GitHubActionsPermissions[] WritePermissions { get; set; } = new GitHubActionsPermissions[0]; @@ -278,5 +281,14 @@ protected virtual IEnumerable GetTriggers() if (OnCronSchedule != null) yield return new GitHubActionsScheduledTrigger { Cron = OnCronSchedule }; + + if (OnIssueCommentTypes.Length > 0) + yield return new GitHubActionsIssueCommentTrigger { Types = OnIssueCommentTypes }; + + if (OnIssueTypes.Length > 0) + yield return new GitHubActionsIssueTrigger { Types = OnIssueTypes }; + + if (OnLabelTypes.Length > 0) + yield return new GitHubActionsLabelTrigger { Types = OnLabelTypes }; } }