From 0cdc6fd88bfc3d2558ee5d697f29da8a1bdc4c05 Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Fri, 19 Dec 2025 16:25:23 +0000 Subject: [PATCH] test: missing shell property in composite action (#20) Make sure we report schema errors consistently Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/20 Co-authored-by: Christopher Homberger Co-committed-by: Christopher Homberger --- pkg/schema/schema_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pkg/schema/schema_test.go b/pkg/schema/schema_test.go index 53dc8146..d2683d66 100644 --- a/pkg/schema/schema_test.go +++ b/pkg/schema/schema_test.go @@ -223,3 +223,41 @@ jobs: }) } } + +func TestActionSchemaErrors(t *testing.T) { + table := []struct { + name string // test name + input string // workflow yaml input + err string // error message substring + }{ + { + name: "missing property shell", + input: ` +runs: + using: composite + steps: + - run: echo failure +`, + err: "missing property shell", + }, + } + + for _, test := range table { + t.Run(test.name, func(t *testing.T) { + var node yaml.Node + err := yaml.Unmarshal([]byte(test.input), &node) + if !assert.NoError(t, err) { + return + } + err = (&Node{ + Definition: "action-root", + Schema: GetActionSchema(), + }).UnmarshalYAML(&node) + if test.err != "" { + assert.ErrorContains(t, err, test.err) + } else { + assert.NoError(t, err) + } + }) + } +}