Skip to content

Commit

Permalink
Replace deprecated commands (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaMann authored Nov 7, 2022
1 parent 29275f5 commit bf65faa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/GitHubActions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ log_warning(msg) = command("warning", (), msg)
Save value `v` with name `k` to state.
"""
save_state(k, v) = command("save-state", (name=k,), v)
save_state(k, v) = add_to_file("GITHUB_STATE", "$k=$v")

"""
set_command_echo(enable)
Expand All @@ -130,7 +130,7 @@ set_command_echo(enable) = command("echo", (), enable ? "on" : "off")
Set the output with name `k` to value `v`.
"""
set_output(k, v) = command("set-output", (name=k,), v)
set_output(k, v) = add_to_file("GITHUB_OUTPUT", "$k=$v")

"""
set_secret(v)
Expand Down
14 changes: 12 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ const GHA = GitHubActions
@test (@capture_out log_error("a")) == "::error::a\n"
@test (@capture_out log_warning("a")) == "::warning::a\n"

@test (@capture_out save_state("a", "b")) == "::save-state name=a::b\n"
mktemp() do file, io
withenv("GITHUB_STATE" => file) do
save_state("a", "b")
@test read(file, String) == "a=b\n"
end
end

@test (@capture_out set_command_echo(true)) == "::echo::on\n"
@test (@capture_out set_command_echo(false)) == "::echo::off\n"

@test (@capture_out set_output("a", "b")) == "::set-output name=a::b\n"
mktemp() do file, io
withenv("GITHUB_OUTPUT" => file) do
set_output("a", "b")
@test read(file, String) == "a=b\n"
end
end

@test (@capture_out set_secret("a")) == "::add-mask::a\n"

Expand Down

0 comments on commit bf65faa

Please sign in to comment.