Skip to content

Commit 942546d

Browse files
committed
(build) use the GitHubAction StartGroup and EndGroup
1 parent a9c8e14 commit 942546d

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

build/chores/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
return new CakeHost()
44
.UseContext<BuildContext>()
5-
.UseStartup<Startup>()
65
.Run(args);

build/chores/Startup.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

build/common/Utilities/ContextExtensions.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Cake.Common.Build.AzurePipelines;
12
using Xunit;
23

34
namespace Common.Utilities;
@@ -109,30 +110,27 @@ public static string GetBuildAgent(this ICakeContext context)
109110
public static void StartGroup(this ICakeContext context, string title)
110111
{
111112
var buildSystem = context.BuildSystem();
112-
var startGroup = "[group]";
113113
if (buildSystem.IsRunningOnAzurePipelines)
114114
{
115-
startGroup = "##[group]";
115+
context.AzurePipelines().Commands.StartGroup(context, title);
116116
}
117117
else if (buildSystem.IsRunningOnGitHubActions)
118118
{
119-
startGroup = "::group::";
119+
context.GitHubActions().Commands.StartGroup(title);
120120
}
121-
context.Information($"{startGroup}{title}");
122121
}
122+
123123
public static void EndGroup(this ICakeContext context)
124124
{
125125
var buildSystem = context.BuildSystem();
126-
var endgroup = "[endgroup]";
127126
if (buildSystem.IsRunningOnAzurePipelines)
128127
{
129-
endgroup = "##[endgroup]";
128+
context.AzurePipelines().Commands.EndGroup(context);
130129
}
131130
else if (buildSystem.IsRunningOnGitHubActions)
132131
{
133-
endgroup = "::endgroup::";
132+
context.GitHubActions().Commands.EndGroup();
134133
}
135-
context.Information($"{endgroup}");
136134
}
137135

138136
public static bool ShouldRun(this ICakeContext context, bool criteria, string skipMessage)
@@ -161,4 +159,8 @@ public static string GetBranchName(this ICakeContext context)
161159
}
162160
return repositoryBranch;
163161
}
162+
163+
private static void StartGroup(this IAzurePipelinesCommands _, ICakeContext context, string title) => context.Information("##[group]{0}", title);
164+
165+
private static void EndGroup(this IAzurePipelinesCommands _, ICakeContext context) => context.Information("##[endgroup]");
164166
}

0 commit comments

Comments
 (0)