ExtractActionsFromLockFile parses a lock.yml file and extracts all action usages
(lockFilePath string)
| 33 | |
| 34 | // ExtractActionsFromLockFile parses a lock.yml file and extracts all action usages |
| 35 | func ExtractActionsFromLockFile(lockFilePath string) ([]ActionUsage, error) { |
| 36 | actionSHACheckerLog.Printf("Extracting actions from lock file: %s", lockFilePath) |
| 37 | |
| 38 | content, err := os.ReadFile(lockFilePath) |
| 39 | if err != nil { |
| 40 | return nil, fmt.Errorf("failed to read lock file: %w", err) |
| 41 | } |
| 42 | |
| 43 | // Validate lock file schema compatibility before parsing |
| 44 | if err := ValidateLockSchemaCompatibility(string(content), lockFilePath); err != nil { |
| 45 | return nil, err |
| 46 | } |
| 47 | if err := validateLockYAML(content); err != nil { |
| 48 | return nil, err |
| 49 | } |
| 50 | return extractActionsFromContent(string(content)), nil |
| 51 | } |
| 52 | |
| 53 | func validateLockYAML(content []byte) error { |
| 54 | var workflowData map[string]any |