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
This commit is contained in:
Björn Brauer 2021-12-09 16:10:56 +01:00 committed by GitHub
parent 1891c72ab1
commit fec0c0c529
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -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)

View file

@ -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) {