From fec0c0c529f5510464c858ff9a6664e0647245a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Brauer?= Date: Thu, 9 Dec 2021 16:10:56 +0100 Subject: [PATCH] fix: ::stop-commands:: should continue to print the lines (#920) > This special command allows you to log anything without accidentally running a workflow command. https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#stopping-and-starting-workflow-commands Example: https://github.com/ZauberNerd/act-test/runs/4469496818?check_suite_focus=true#step:8:10 --- pkg/runner/command.go | 1 + pkg/runner/command_test.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/runner/command.go b/pkg/runner/command.go index 48166d2..956ee0a 100755 --- a/pkg/runner/command.go +++ b/pkg/runner/command.go @@ -36,6 +36,7 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler { } if resumeCommand != "" && command != resumeCommand { + logger.Infof(" \U00002699 %s", line) return false } arg = unescapeCommandData(arg) diff --git a/pkg/runner/command_test.go b/pkg/runner/command_test.go index d4981fe..4d6c548 100644 --- a/pkg/runner/command_test.go +++ b/pkg/runner/command_test.go @@ -64,8 +64,10 @@ func TestAddpath(t *testing.T) { } func TestStopCommands(t *testing.T) { + logger, hook := test.NewNullLogger() + a := assert.New(t) - ctx := context.Background() + ctx := common.WithLogger(context.Background(), logger) rc := new(RunContext) handler := rc.commandHandler(ctx) @@ -77,6 +79,13 @@ func TestStopCommands(t *testing.T) { handler("::my-end-token::\n") handler("::set-env name=x::abcd\n") a.Equal("abcd", rc.Env["x"]) + + messages := make([]string, 0) + for _, entry := range hook.AllEntries() { + messages = append(messages, entry.Message) + } + + a.Contains(messages, " \U00002699 ::set-env name=x::abcd\n") } func TestAddpathADO(t *testing.T) {