Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated commands #27

Merged
merged 2 commits into from
Nov 7, 2022
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/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