MCPcopy Create free account
hub / github.com/github/gh-aw / TestValidateActionYml

Function TestValidateActionYml

pkg/cli/actions_build_command_test.go:144–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestValidateActionYml(t *testing.T) {
145 tests := []struct {
146 name string
147 actionYmlContent string
148 expectError bool
149 errorContains string
150 }{
151 {
152 name: "valid node20 action",
153 actionYmlContent: `name: Test Action
154description: A test action
155runs:
156 using: 'node20'
157 main: 'index.js'`,
158 expectError: false,
159 },
160 {
161 name: "valid composite action",
162 actionYmlContent: `name: Test Action
163description: A test action
164runs:
165 using: 'composite'
166 steps:
167 - run: echo "test"`,
168 expectError: false,
169 },
170 {
171 name: "missing action.yml",
172 expectError: true,
173 errorContains: "action.yml not found",
174 },
175 {
176 name: "missing name field",
177 actionYmlContent: `description: A test action
178runs:
179 using: 'node20'`,
180 expectError: true,
181 errorContains: "missing required field 'name'",
182 },
183 {
184 name: "missing description field",
185 actionYmlContent: `name: Test Action
186runs:
187 using: 'node20'`,
188 expectError: true,
189 errorContains: "missing required field 'description'",
190 },
191 {
192 name: "missing runs field",
193 actionYmlContent: `name: Test Action
194description: A test action`,
195 expectError: true,
196 errorContains: "missing required field 'runs'",
197 },
198 {
199 name: "valid node24 action",
200 actionYmlContent: `name: Test Action
201description: A test action

Callers

nothing calls this directly

Calls 3

validateActionYmlFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected