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

Function extractDispatchItemNumber

pkg/workflow/workflow_builder.go:553–580  ·  view source on GitHub ↗

extractDispatchItemNumber reports whether the frontmatter's on.workflow_dispatch trigger exposes an item_number input. This is the signature produced by the label trigger shorthand (e.g. "on: pull_request labeled my-label"). Reading the structured map avoids re-parsing the rendered YAML string later

(frontmatter map[string]any)

Source from the content-addressed store, hash-verified

551// trigger shorthand (e.g. "on: pull_request labeled my-label"). Reading the
552// structured map avoids re-parsing the rendered YAML string later.
553func extractDispatchItemNumber(frontmatter map[string]any) bool {
554 onVal, ok := frontmatter["on"]
555 if !ok {
556 return false
557 }
558 onMap, ok := onVal.(map[string]any)
559 if !ok {
560 return false
561 }
562 wdVal, ok := onMap["workflow_dispatch"]
563 if !ok {
564 return false
565 }
566 wdMap, ok := wdVal.(map[string]any)
567 if !ok {
568 return false
569 }
570 inputsVal, ok := wdMap["inputs"]
571 if !ok {
572 return false
573 }
574 inputsMap, ok := inputsVal.(map[string]any)
575 if !ok {
576 return false
577 }
578 _, ok = inputsMap["item_number"]
579 return ok
580}
581
582// processAndMergeSteps handles the merging of imported steps with main workflow steps
583func (c *Compiler) processAndMergeSteps(frontmatter map[string]any, workflowData *WorkflowData, importsResult *parser.ImportsResult) error {

Calls

no outgoing calls