From 018b45ffead3207aa3fcd9192ff818cd1c3713d3 Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Thu, 28 Aug 2025 21:43:30 +0200 Subject: [PATCH 1/3] Fix handle more errors --- actionsdotnetactcompat/act_worker.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/actionsdotnetactcompat/act_worker.go b/actionsdotnetactcompat/act_worker.go index 9dc06f0..8c60748 100644 --- a/actionsdotnetactcompat/act_worker.go +++ b/actionsdotnetactcompat/act_worker.go @@ -161,7 +161,11 @@ func (f *ghaFormatter) Format(entry *logrus.Entry) ([]byte, error) { if f.rqt.MaskHints != nil { for _, v := range f.rqt.MaskHints { if strings.EqualFold(v.Type, "regex") { - r, _ := regexp.Compile(v.Value) + r, err := regexp.Compile(v.Value) + if err != nil { + // TODO precompile regex and log errors + continue + } msg = r.ReplaceAllString(msg, "***") } } @@ -244,7 +248,11 @@ func ExecWorker(rqt *protocol.AgentJobRequestMessage, wc actionsrunner.WorkerCon } actLogger.SetFormatter(formatter) actLogger.Println("Initialize translating the job request to actions-oss/act-cli (nektos/act)") - vssConnection, vssConnectionData, _ := rqt.GetConnection("SystemVssConnection") + vssConnection, vssConnectionData, conErr := rqt.GetConnection("SystemVssConnection") + if conErr != nil { + wc.FailInitJob("Failed to initialize Job", conErr.Error()) + return + } if jlogger.Connection != nil { vssConnection.Client = jlogger.Connection.Client vssConnection.Trace = jlogger.Connection.Trace @@ -334,8 +342,10 @@ func ExecWorker(rqt *protocol.AgentJobRequestMessage, wc actionsrunner.WorkerCon return } var payload string - { - e, _ := json.Marshal(githubCtxMap["event"]) + if e, err := json.Marshal(githubCtxMap["event"]); err != nil { + failInitJob(fmt.Sprintf("cannot convert github.event to json: %w", err)) + return + } else { payload = string(e) } unixHostPrefix := "unix://" From e0177ef0222f1d59ab6b4510dfb90300f21eff7a Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Thu, 28 Aug 2025 21:48:38 +0200 Subject: [PATCH 2/3] . --- actionsdotnetactcompat/act_worker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionsdotnetactcompat/act_worker.go b/actionsdotnetactcompat/act_worker.go index 8c60748..27bff47 100644 --- a/actionsdotnetactcompat/act_worker.go +++ b/actionsdotnetactcompat/act_worker.go @@ -342,8 +342,8 @@ func ExecWorker(rqt *protocol.AgentJobRequestMessage, wc actionsrunner.WorkerCon return } var payload string - if e, err := json.Marshal(githubCtxMap["event"]); err != nil { - failInitJob(fmt.Sprintf("cannot convert github.event to json: %w", err)) + if e, eventErr := json.Marshal(githubCtxMap["event"]); eventErr != nil { + failInitJob(fmt.Sprintf("cannot convert github.event to json: %w", eventErr)) return } else { payload = string(e) From 37523be2c54c3a68a92976b956acff4ff4d7ec0c Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Thu, 28 Aug 2025 21:49:36 +0200 Subject: [PATCH 3/3] . --- actionsdotnetactcompat/act_worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionsdotnetactcompat/act_worker.go b/actionsdotnetactcompat/act_worker.go index 27bff47..9a047a0 100644 --- a/actionsdotnetactcompat/act_worker.go +++ b/actionsdotnetactcompat/act_worker.go @@ -343,7 +343,7 @@ func ExecWorker(rqt *protocol.AgentJobRequestMessage, wc actionsrunner.WorkerCon } var payload string if e, eventErr := json.Marshal(githubCtxMap["event"]); eventErr != nil { - failInitJob(fmt.Sprintf("cannot convert github.event to json: %w", eventErr)) + failInitJob(fmt.Sprintf("cannot convert github.event to json: %s", eventErr.Error())) return } else { payload = string(e)