Skip to content

Commit 2b860ce

Browse files
committed
Remove emojis in command outputs (#97)
Remove emojis in command outputs; leave others since they don't matter. Help go-gitea/gitea#29777 Reviewed-on: https://gitea.com/gitea/act/pulls/97
1 parent 3a9e7d1 commit 2b860ce

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

pkg/runner/command.go

+21-13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
)
1010

1111
var commandPatternGA *regexp.Regexp
12+
1213
var commandPatternADO *regexp.Regexp
1314

1415
func init() {
@@ -41,7 +42,9 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler {
4142
}
4243

4344
if resumeCommand != "" && command != resumeCommand {
44-
logger.Infof(" \U00002699 %s", line)
45+
// There should not be any emojis in the log output for Gitea.
46+
// The code in the switch statement is the same.
47+
logger.Infof("%s", line)
4548
return false
4649
}
4750
arg = unescapeCommandData(arg)
@@ -54,27 +57,27 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler {
5457
case "add-path":
5558
rc.addPath(ctx, arg)
5659
case "debug":
57-
logger.Infof(" \U0001F4AC %s", line)
60+
logger.Infof("%s", line)
5861
case "warning":
59-
logger.Infof(" \U0001F6A7 %s", line)
62+
logger.Infof("%s", line)
6063
case "error":
61-
logger.Infof(" \U00002757 %s", line)
64+
logger.Infof("%s", line)
6265
case "add-mask":
6366
rc.AddMask(arg)
64-
logger.Infof(" \U00002699 %s", "***")
67+
logger.Infof("%s", "***")
6568
case "stop-commands":
6669
resumeCommand = arg
67-
logger.Infof(" \U00002699 %s", line)
70+
logger.Infof("%s", line)
6871
case resumeCommand:
6972
resumeCommand = ""
70-
logger.Infof(" \U00002699 %s", line)
73+
logger.Infof("%s", line)
7174
case "save-state":
72-
logger.Infof(" \U0001f4be %s", line)
75+
logger.Infof("%s", line)
7376
rc.saveState(ctx, kvPairs, arg)
7477
case "add-matcher":
75-
logger.Infof(" \U00002753 add-matcher %s", arg)
78+
logger.Infof("%s", line)
7679
default:
77-
logger.Infof(" \U00002753 %s", line)
80+
logger.Infof("%s", line)
7881
}
7982

8083
// return true to let gitea's logger handle these special outputs also
@@ -84,7 +87,7 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler {
8487

8588
func (rc *RunContext) setEnv(ctx context.Context, kvPairs map[string]string, arg string) {
8689
name := kvPairs["name"]
87-
common.Logger(ctx).Infof(" \U00002699 ::set-env:: %s=%s", name, arg)
90+
common.Logger(ctx).Infof("::set-env:: %s=%s", name, arg)
8891
if rc.Env == nil {
8992
rc.Env = make(map[string]string)
9093
}
@@ -101,6 +104,7 @@ func (rc *RunContext) setEnv(ctx context.Context, kvPairs map[string]string, arg
101104
mergeIntoMap(rc.Env, newenv)
102105
mergeIntoMap(rc.GlobalEnv, newenv)
103106
}
107+
104108
func (rc *RunContext) setOutput(ctx context.Context, kvPairs map[string]string, arg string) {
105109
logger := common.Logger(ctx)
106110
stepID := rc.CurrentStep
@@ -116,11 +120,12 @@ func (rc *RunContext) setOutput(ctx context.Context, kvPairs map[string]string,
116120
return
117121
}
118122

119-
logger.Infof(" \U00002699 ::set-output:: %s=%s", outputName, arg)
123+
logger.Infof("::set-output:: %s=%s", outputName, arg)
120124
result.Outputs[outputName] = arg
121125
}
126+
122127
func (rc *RunContext) addPath(ctx context.Context, arg string) {
123-
common.Logger(ctx).Infof(" \U00002699 ::add-path:: %s", arg)
128+
common.Logger(ctx).Infof("::add-path:: %s", arg)
124129
extraPath := []string{arg}
125130
for _, v := range rc.ExtraPath {
126131
if v != arg {
@@ -141,6 +146,7 @@ func parseKeyValuePairs(kvPairs string, separator string) map[string]string {
141146
}
142147
return rtn
143148
}
149+
144150
func unescapeCommandData(arg string) string {
145151
escapeMap := map[string]string{
146152
"%25": "%",
@@ -152,6 +158,7 @@ func unescapeCommandData(arg string) string {
152158
}
153159
return arg
154160
}
161+
155162
func unescapeCommandProperty(arg string) string {
156163
escapeMap := map[string]string{
157164
"%25": "%",
@@ -165,6 +172,7 @@ func unescapeCommandProperty(arg string) string {
165172
}
166173
return arg
167174
}
175+
168176
func unescapeKvPairs(kvPairs map[string]string) map[string]string {
169177
for k, v := range kvPairs {
170178
kvPairs[k] = unescapeCommandProperty(v)

0 commit comments

Comments
 (0)