|
| 1 | +using Cake.Common.Build.AzurePipelines; |
1 | 2 | using Xunit; |
2 | 3 |
|
3 | 4 | namespace Common.Utilities; |
@@ -109,30 +110,27 @@ public static string GetBuildAgent(this ICakeContext context) |
109 | 110 | public static void StartGroup(this ICakeContext context, string title) |
110 | 111 | { |
111 | 112 | var buildSystem = context.BuildSystem(); |
112 | | - var startGroup = "[group]"; |
113 | 113 | if (buildSystem.IsRunningOnAzurePipelines) |
114 | 114 | { |
115 | | - startGroup = "##[group]"; |
| 115 | + context.AzurePipelines().Commands.StartGroup(context, title); |
116 | 116 | } |
117 | 117 | else if (buildSystem.IsRunningOnGitHubActions) |
118 | 118 | { |
119 | | - startGroup = "::group::"; |
| 119 | + context.GitHubActions().Commands.StartGroup(title); |
120 | 120 | } |
121 | | - context.Information($"{startGroup}{title}"); |
122 | 121 | } |
| 122 | + |
123 | 123 | public static void EndGroup(this ICakeContext context) |
124 | 124 | { |
125 | 125 | var buildSystem = context.BuildSystem(); |
126 | | - var endgroup = "[endgroup]"; |
127 | 126 | if (buildSystem.IsRunningOnAzurePipelines) |
128 | 127 | { |
129 | | - endgroup = "##[endgroup]"; |
| 128 | + context.AzurePipelines().Commands.EndGroup(context); |
130 | 129 | } |
131 | 130 | else if (buildSystem.IsRunningOnGitHubActions) |
132 | 131 | { |
133 | | - endgroup = "::endgroup::"; |
| 132 | + context.GitHubActions().Commands.EndGroup(); |
134 | 133 | } |
135 | | - context.Information($"{endgroup}"); |
136 | 134 | } |
137 | 135 |
|
138 | 136 | public static bool ShouldRun(this ICakeContext context, bool criteria, string skipMessage) |
@@ -161,4 +159,8 @@ public static string GetBranchName(this ICakeContext context) |
161 | 159 | } |
162 | 160 | return repositoryBranch; |
163 | 161 | } |
| 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]"); |
164 | 166 | } |
0 commit comments