Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/GitVersionCore.Tests/BuildAgents/GitHubActionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionCore/BuildAgents/GitHubActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ 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))
{
var key = $"GitVersion_{name}";

return new[]
{
$"::set-env name={key}::{value}"
$"\"{key}={value}\" >> $GITHUB_ENV"
};
}

Expand Down