buildSetupAction builds the setup action by checking that source files exist. Note: Both JavaScript and shell scripts are source of truth in actions/setup/js/ and actions/setup/sh/ These files are manually edited and committed to git. They are NOT synced to pkg/workflow/ At runtime, setup.sh copies
(actionsDir, actionName string)
| 302 | // These files are manually edited and committed to git. They are NOT synced to pkg/workflow/ |
| 303 | // At runtime, setup.sh copies these files to /tmp/gh-aw/actions for workflow execution. |
| 304 | func buildSetupAction(actionsDir, actionName string) error { |
| 305 | actionsBuildLog.Printf("Building setup action: actionsDir=%s, actionName=%s", actionsDir, actionName) |
| 306 | actionPath := filepath.Join(actionsDir, actionName) |
| 307 | jsDir := filepath.Join(actionPath, "js") |
| 308 | shDir := filepath.Join(actionPath, "sh") |
| 309 | |
| 310 | // JavaScript files in actions/setup/js/ are the source of truth |
| 311 | if fileutil.DirExists(jsDir) { |
| 312 | // Count JavaScript files |
| 313 | entries, err := os.ReadDir(jsDir) |
| 314 | if err == nil { |
| 315 | jsCount := 0 |
| 316 | for _, entry := range entries { |
| 317 | if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".cjs") { |
| 318 | jsCount++ |
| 319 | } |
| 320 | } |
| 321 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ JavaScript files in js/ (source of truth): %d", jsCount))) |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // Shell scripts in actions/setup/sh/ are the source of truth |
| 326 | if fileutil.DirExists(shDir) { |
| 327 | // Count shell scripts |
| 328 | entries, err := os.ReadDir(shDir) |
| 329 | if err == nil { |
| 330 | shCount := 0 |
| 331 | for _, entry := range entries { |
| 332 | if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".sh") { |
| 333 | shCount++ |
| 334 | } |
| 335 | } |
| 336 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ Shell scripts in sh/ (source of truth): %d", shCount))) |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | return nil |
| 341 | } |
| 342 | |
| 343 | // getActionDependencies returns the list of JavaScript dependencies for an action |
| 344 | // This mapping defines which files from pkg/workflow/js/ are needed for each action |
no test coverage detected