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

Function parseBoolReactionField

pkg/workflow/reactions.go:132–142  ·  view source on GitHub ↗

parseBoolReactionField reads a boolean field from a reaction config map. Returns true if the key is absent (defaults to enabled), or the parsed bool value.

(m map[string]any, key string)

Source from the content-addressed store, hash-verified

130// parseBoolReactionField reads a boolean field from a reaction config map.
131// Returns true if the key is absent (defaults to enabled), or the parsed bool value.
132func parseBoolReactionField(m map[string]any, key string) (bool, error) {
133 v, ok := m[key]
134 if !ok {
135 return true, nil
136 }
137 b, ok := v.(bool)
138 if !ok {
139 return false, fmt.Errorf("reaction.%s must be a boolean value, got %T", key, v)
140 }
141 return b, nil
142}
143
144// intToReactionString converts an integer to a reaction string.
145// Only 1 (+1) and -1 are valid integer values for reactions.

Callers 1

parseReactionConfigFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected