Skip to content

Commit 4047790

Browse files
wolfogreLinux User
authored and
Linux User
committed
Do not crash when parsing an invalid workflow file (go-gitea#23972)
Fix go-gitea#23658. Related to https://gitea.com/gitea/act/pulls/39
1 parent 085b563 commit 4047790

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
285285

286286
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
287287

288-
replace github.com/nektos/act => gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab
288+
replace github.com/nektos/act => gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797
289289

290290
exclude github.com/gofrs/uuid v3.2.0+incompatible
291291

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsi
7070
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
7171
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
7272
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
73-
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab h1:HDImhO/XpMJrw2PJcADI/wgur9Gro/pegLFaRt8Wpg0=
74-
gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
73+
gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797 h1:QdQ+pHxpbIi2qsgZbYVxqYV7trfW3P5M/T4AfpoM7iw=
74+
gitea.com/gitea/act v0.243.3-0.20230407083103-5c4a96bcb797/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
7575
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681 h1:MMSPgnVULVwV9kEBgvyEUhC9v/uviZ55hPJEMjpbNR4=
7676
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
7777
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=

modules/actions/workflows.go

+10
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ import (
1717
"github.com/nektos/act/pkg/jobparser"
1818
"github.com/nektos/act/pkg/model"
1919
"github.com/nektos/act/pkg/workflowpattern"
20+
"gopkg.in/yaml.v3"
2021
)
2122

23+
func init() {
24+
model.OnDecodeNodeError = func(node yaml.Node, out interface{}, err error) {
25+
// Log the error instead of panic or fatal.
26+
// It will be a big job to refactor act/pkg/model to return decode error,
27+
// so we just log the error and return empty value, and improve it later.
28+
log.Error("Failed to decode node %v into %T: %v", node, out, err)
29+
}
30+
}
31+
2232
func ListWorkflows(commit *git.Commit) (git.Entries, error) {
2333
tree, err := commit.SubTree(".gitea/workflows")
2434
if _, ok := err.(git.ErrNotExist); ok {

0 commit comments

Comments
 (0)