diff --git a/src/GitHubActions.jl b/src/GitHubActions.jl index c1fe9e8..d9ff913 100644 --- a/src/GitHubActions.jl +++ b/src/GitHubActions.jl @@ -3,6 +3,7 @@ module GitHubActions export GitHubActionsLogger, add_path, + add_summary, end_group, get_input, get_state, @@ -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) diff --git a/test/runtests.jl b/test/runtests.jl index d81a1c0..e5f3e41 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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")