diff --git a/src/GitHubActions.jl b/src/GitHubActions.jl index b2b5634..4acf6a5 100644 --- a/src/GitHubActions.jl +++ b/src/GitHubActions.jl @@ -130,7 +130,14 @@ set_command_echo(enable) = command("echo", (), enable ? "on" : "off") Set the output with name `k` to value `v`. """ -set_output(k, v) = add_to_file("GITHUB_OUTPUT", "$k=$v") +function set_output(k, v) + val = cmd_value(v) + delimiter = "EOF" + while occursin(delimiter, val) + delimiter *= "EOF" + end + add_to_file("GITHUB_OUTPUT", join(["$k<<$delimiter", val, delimiter], "\n")) +end """ set_secret(v) diff --git a/test/runtests.jl b/test/runtests.jl index d09e182..741f98b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -38,9 +38,16 @@ const GHA = GitHubActions @test (@capture_out set_command_echo(false)) == "::echo::off\n" mktemp() do file, io - withenv("GITHUB_OUTPUT" => file) do + withenv("GITHUB_OUTPUT" => file, map(c -> string(c) => nothing, 'a':'z')...) do set_output("a", "b") - @test read(file, String) == "a=b\n" + @test read(file, String) == "a<