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

Method validateResourcesAndDispatches

pkg/workflow/compiler_validators.go:358–384  ·  view source on GitHub ↗
(workflowData *WorkflowData, markdownPath string)

Source from the content-addressed store, hash-verified

356}
357
358func (c *Compiler) validateResourcesAndDispatches(workflowData *WorkflowData, markdownPath string) error {
359 workflowLog.Printf("Validating resources field")
360 if workflowData.ParsedFrontmatter != nil {
361 for _, r := range workflowData.ParsedFrontmatter.Resources {
362 if strings.Contains(r, "${{") {
363 return formatCompilerError(markdownPath, "error",
364 fmt.Sprintf("resources entry %q contains GitHub Actions expression syntax (${{) which is not allowed; use static paths only", r), nil)
365 }
366 }
367 }
368 dispatchValidators := []struct {
369 logMessage string
370 errPrefix string
371 validateFn func(*WorkflowData, string) error
372 }{
373 {logMessage: "Validating dispatch-workflow configuration", errPrefix: "dispatch-workflow validation failed: ", validateFn: c.validateDispatchWorkflow},
374 {logMessage: "Validating dispatch_repository configuration", errPrefix: "dispatch_repository validation failed: ", validateFn: c.validateDispatchRepository},
375 {logMessage: "Validating call-workflow configuration", errPrefix: "call-workflow validation failed: ", validateFn: c.validateCallWorkflow},
376 }
377 for _, validator := range dispatchValidators {
378 workflowLog.Print(validator.logMessage)
379 if err := validator.validateFn(workflowData, markdownPath); err != nil {
380 return formatCompilerError(markdownPath, "error", validator.errPrefix+err.Error(), err)
381 }
382 }
383 return nil
384}
385
386// shouldWarnSparseInteractionCells reports whether the compiler should emit a
387// sparse-cell interaction warning.

Callers 1

Calls 4

formatCompilerErrorFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected