chore(yaml): Improve ParseRawOn (#28)

See [act_runner #71 comment](https://gitea.com/gitea/act_runner/issues/71#issuecomment-733806), we need to handle `nil interface{}` in `ParseRawOn` function

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/28
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
Zettat123 2023-03-25 12:13:50 +08:00 committed by appleboy
parent 7c5400d75b
commit 3daf313205

View file

@ -177,6 +177,13 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
}
res := make([]*Event, 0, len(val))
for k, v := range val {
if v == nil {
res = append(res, &Event{
Name: k,
Acts: map[string][]string{},
})
continue
}
switch t := v.(type) {
case string:
res = append(res, &Event{