(t *testing.T)
| 397 | } |
| 398 | |
| 399 | func TestBuildAction_CompositeAction(t *testing.T) { |
| 400 | // Create a temporary directory with a composite action |
| 401 | tmpDir := t.TempDir() |
| 402 | originalDir, err := os.Getwd() |
| 403 | require.NoError(t, err, "Failed to get current directory") |
| 404 | defer os.Chdir(originalDir) |
| 405 | |
| 406 | err = os.Chdir(tmpDir) |
| 407 | require.NoError(t, err, "Failed to change to temp directory") |
| 408 | |
| 409 | actionsDir := filepath.Join(tmpDir, "actions") |
| 410 | compositeActionPath := filepath.Join(actionsDir, "test-composite") |
| 411 | err = os.MkdirAll(compositeActionPath, 0755) |
| 412 | require.NoError(t, err, "Failed to create composite action directory") |
| 413 | |
| 414 | // Create action.yml for composite action |
| 415 | actionYml := `name: Test Composite Action |
| 416 | description: A test composite action |
| 417 | runs: |
| 418 | using: 'composite' |
| 419 | steps: |
| 420 | - run: echo "test" |
| 421 | shell: bash` |
| 422 | err = os.WriteFile(filepath.Join(compositeActionPath, "action.yml"), []byte(actionYml), 0644) |
| 423 | require.NoError(t, err, "Failed to write action.yml") |
| 424 | |
| 425 | // Build the composite action (should succeed without src/index.js) |
| 426 | err = buildAction("actions", "test-composite") |
| 427 | require.NoError(t, err, "Should successfully build composite action without JavaScript source") |
| 428 | |
| 429 | // Verify that no index.js was generated |
| 430 | indexPath := filepath.Join(compositeActionPath, "index.js") |
| 431 | _, err = os.Stat(indexPath) |
| 432 | assert.True(t, os.IsNotExist(err), "index.js should not be generated for composite actions") |
| 433 | } |
nothing calls this directly
no test coverage detected