Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/GitHubActions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module GitHubActions
export
GitHubActionsLogger,
add_path,
add_summary,
end_group,
get_input,
get_state,
Expand Down Expand Up @@ -212,6 +213,15 @@ function set_failed(msg)
log_error(msg)
end

"""
add_summary(v)

Add `v` to the job summary.
"""
function add_summary(v)
add_to_file("GITHUB_STEP_SUMMARY", v)
end

"""
GitHubActionsLogger(level)

Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ const GHA = GitHubActions
end
end

mktemp() do file, io
withenv("GITHUB_STEP_SUMMARY" => file) do
add_summary("testsummary")
@test read(file, String) == "testsummary\n"
add_summary("anothersummary")
@test read(file, String) == "testsummary\nanothersummary\n"
end
end

withenv(() -> (@test get_input("A") == ""), "INPUT_A" => "")
withenv(() -> (@test get_input("A") == ""), "INPUT_A" => nothing)
withenv(() -> (@test get_input("A") == "b"), "INPUT_A" => "b")
Expand Down