From 6a36b366ff93e11ebee78c3959ed050097b841a3 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 2 Mar 2022 20:38:28 -0600 Subject: [PATCH] Use 'File.AppendLine()' to generate output Let the 'System.IO.File' provider handle newlines between entries rather than manually inserting them Addresses item 2 of #726 --- src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs b/src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs index 48ca3bbfb..f3931042f 100644 --- a/src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs +++ b/src/NerdBank.GitVersioning/CloudBuildServices/GitHubActions.cs @@ -28,7 +28,7 @@ internal class GitHubActions : ICloudBuild public IReadOnlyDictionary SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr) { - Utilities.FileOperationWithRetry(() => File.AppendAllText(EnvironmentFile, $"{Environment.NewLine}{name}={value}{Environment.NewLine}")); + Utilities.FileOperationWithRetry(() => File.AppendAllLines(EnvironmentFile, new [] {$"{name}={value}"})); return GetDictionaryFor(name, value); }