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

Function getFeatureValueFromFrontmatter

pkg/workflow/features.go:54–80  ·  view source on GitHub ↗
(flagLower string, workflowData *WorkflowData, logEnabled bool)

Source from the content-addressed store, hash-verified

52}
53
54func getFeatureValueFromFrontmatter(flagLower string, workflowData *WorkflowData, logEnabled bool) (bool, bool) {
55 if workflowData == nil || workflowData.Features == nil {
56 return false, false
57 }
58
59 if value, exists := workflowData.Features[flagLower]; exists {
60 if enabled, found := parseFeatureValue(value); found {
61 if logEnabled {
62 featuresLog.Printf("Feature found in frontmatter: %s=%v", flagLower, enabled)
63 }
64 return enabled, true
65 }
66 }
67
68 for key, value := range workflowData.Features {
69 if strings.EqualFold(key, flagLower) {
70 if enabled, found := parseFeatureValue(value); found {
71 if logEnabled {
72 featuresLog.Printf("Feature found in frontmatter (case-insensitive): %s=%v", flagLower, enabled)
73 }
74 return enabled, true
75 }
76 }
77 }
78
79 return false, false
80}
81
82func parseFeatureValue(value any) (bool, bool) {
83 if enabled, ok := value.(bool); ok {

Callers 1

isFeatureEnabledFunction · 0.85

Calls 2

parseFeatureValueFunction · 0.85
PrintfMethod · 0.45

Tested by

no test coverage detected