ActionsValidateCommand validates all action.yml files
()
| 55 | |
| 56 | // ActionsValidateCommand validates all action.yml files |
| 57 | func ActionsValidateCommand() error { |
| 58 | actionsDir := "actions" |
| 59 | |
| 60 | actionsBuildLog.Print("Starting actions validation") |
| 61 | |
| 62 | // Get list of action directories |
| 63 | actionDirs, err := getActionDirectories(actionsDir) |
| 64 | if err != nil { |
| 65 | return err |
| 66 | } |
| 67 | |
| 68 | if len(actionDirs) == 0 { |
| 69 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage("No action directories found in actions/")) |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage("✅ Validating all actions")) |
| 74 | |
| 75 | allValid := true |
| 76 | for _, actionName := range actionDirs { |
| 77 | actionPath := filepath.Join(actionsDir, actionName) |
| 78 | if err := validateActionYml(actionPath); err != nil { |
| 79 | fmt.Fprintln(os.Stderr, console.FormatErrorMessage(fmt.Sprintf("✗ %s/action.yml: %s", actionName, err.Error()))) |
| 80 | allValid = false |
| 81 | } else { |
| 82 | fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ %s/action.yml is valid", actionName))) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | if !allValid { |
| 87 | return errors.New("validation failed for one or more actions") |
| 88 | } |
| 89 | |
| 90 | fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("✨ All actions valid")) |
| 91 | return nil |
| 92 | } |
| 93 | |
| 94 | // ActionsCleanCommand removes generated index.js files from all actions |
| 95 | func ActionsCleanCommand() error { |