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

Function TestIsCompositeAction

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

Source from the content-addressed store, hash-verified

326}
327
328func TestIsCompositeAction(t *testing.T) {
329 tests := []struct {
330 name string
331 actionYmlContent string
332 expectComposite bool
333 expectError bool
334 }{
335 {
336 name: "composite action with single quotes",
337 actionYmlContent: `name: Test Action
338description: A test action
339runs:
340 using: 'composite'
341 steps:
342 - run: echo "test"`,
343 expectComposite: true,
344 expectError: false,
345 },
346 {
347 name: "composite action with double quotes",
348 actionYmlContent: `name: Test Action
349description: A test action
350runs:
351 using: "composite"
352 steps:
353 - run: echo "test"`,
354 expectComposite: true,
355 expectError: false,
356 },
357 {
358 name: "node20 action",
359 actionYmlContent: `name: Test Action
360description: A test action
361runs:
362 using: 'node20'
363 main: 'index.js'`,
364 expectComposite: false,
365 expectError: false,
366 },
367 {
368 name: "missing action.yml",
369 expectComposite: false,
370 expectError: true,
371 },
372 }
373
374 for _, tt := range tests {
375 t.Run(tt.name, func(t *testing.T) {
376 tmpDir := t.TempDir()
377 actionPath := filepath.Join(tmpDir, "test-action")
378 err := os.MkdirAll(actionPath, 0755)
379 require.NoError(t, err, "Failed to create action directory")
380
381 if tt.actionYmlContent != "" {
382 ymlPath := filepath.Join(actionPath, "action.yml")
383 err = os.WriteFile(ymlPath, []byte(tt.actionYmlContent), 0644)
384 require.NoError(t, err, "Failed to write action.yml")
385 }

Callers

nothing calls this directly

Calls 3

isCompositeActionFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected