From 88d72bc92fd17277a416b725c5702adf5a5a53b5 Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Fri, 9 Oct 2020 09:29:27 +0200 Subject: [PATCH] Avoid set-env environment warning during build log generation --- src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs | 4 ++-- src/GitVersionCore/BuildAgents/GitHubActions.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs b/src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs index 9eff0adf77..8cf55bcec0 100644 --- a/src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs +++ b/src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs @@ -97,7 +97,7 @@ public void GetCurrentBranchShouldHandlePullRequests() } [TestCase("Something", "1.0.0", - "::set-env name=GitVersion_Something::1.0.0")] + "\"GitVersion_Something=1.0.0\" >> $GITHUB_ENV")] public void GetSetParameterMessage(string key, string value, string expectedResult) { // Assert @@ -141,7 +141,7 @@ public void ShouldWriteIntegration() "Executing GenerateSetVersionMessage for 'GitHubActions'.", "", "Executing GenerateBuildLogOutput for 'GitHubActions'.", - "::set-env name=GitVersion_Major::1.0.0" + "\"GitVersion_Major=1.0.0\" >> $GITHUB_ENV" }; string.Join(Environment.NewLine, list) diff --git a/src/GitVersionCore/BuildAgents/GitHubActions.cs b/src/GitVersionCore/BuildAgents/GitHubActions.cs index 3cc067acfd..be5c3c967a 100644 --- a/src/GitVersionCore/BuildAgents/GitHubActions.cs +++ b/src/GitVersionCore/BuildAgents/GitHubActions.cs @@ -23,9 +23,9 @@ public override string GenerateSetVersionMessage(VersionVariables variables) public override string[] GenerateSetParameterMessage(string name, string value) { - // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-environment-variable-set-env + // https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files // Example - // echo "::set-env name=action_state::yellow" + // echo "name=action_state::yellow >> $GITHUB_ENV" if (!string.IsNullOrWhiteSpace(value)) { @@ -33,7 +33,7 @@ public override string[] GenerateSetParameterMessage(string name, string value) return new[] { - $"::set-env name={key}::{value}" + $"\"{key}={value}\" >> $GITHUB_ENV" }; }