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

Function hasNonEmptyWorkflowRunWorkflows

pkg/workflow/agent_validation.go:347–369  ·  view source on GitHub ↗

hasNonEmptyWorkflowRunWorkflows returns true when workflow_run.workflows includes at least one non-empty workflow name. Supported types: - string: valid when non-empty after trimming whitespace - []string: valid when any item is non-empty after trimming whitespace - []any: valid when any string ite

(v any)

Source from the content-addressed store, hash-verified

345//
346// For all other types, it returns false.
347func hasNonEmptyWorkflowRunWorkflows(v any) bool {
348 switch workflows := v.(type) {
349 case string:
350 return strings.TrimSpace(workflows) != ""
351 case []string:
352 for _, workflow := range workflows {
353 if strings.TrimSpace(workflow) != "" {
354 return true
355 }
356 }
357 return false
358 case []any:
359 for _, workflow := range workflows {
360 s, ok := workflow.(string)
361 if ok && strings.TrimSpace(s) != "" {
362 return true
363 }
364 }
365 return false
366 default:
367 return false
368 }
369}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected