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

Function ExtractActionsFromLockFile

pkg/workflow/action_sha_checker.go:35–51  ·  view source on GitHub ↗

ExtractActionsFromLockFile parses a lock.yml file and extracts all action usages

(lockFilePath string)

Source from the content-addressed store, hash-verified

33
34// ExtractActionsFromLockFile parses a lock.yml file and extracts all action usages
35func 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
53func validateLockYAML(content []byte) error {
54 var workflowData map[string]any

Calls 5

validateLockYAMLFunction · 0.85
PrintfMethod · 0.45
ErrorfMethod · 0.45