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

Function parseNeedsField

pkg/workflow/known_needs_expressions.go:245–255  ·  view source on GitHub ↗

parseNeedsField parses the needs field from a job configuration The needs field can be a string (single dependency) or an array of strings

(needsField any)

Source from the content-addressed store, hash-verified

243// parseNeedsField parses the needs field from a job configuration
244// The needs field can be a string (single dependency) or an array of strings
245func parseNeedsField(needsField any) []string {
246 // GitHub Actions allows `needs: "single-dep"` as shorthand for `needs: ["single-dep"]`
247 if s, ok := needsField.(string); ok {
248 return []string{s}
249 }
250 result := parseStringSliceAny(needsField, nil)
251 if result == nil {
252 return []string{}
253 }
254 return result
255}

Callers 4

TestParseNeedsFieldFunction · 0.85

Calls 1

parseStringSliceAnyFunction · 0.85

Tested by 2

TestParseNeedsFieldFunction · 0.68