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

Function parseManualTrigger

pkg/workflow/trigger_parser.go:414–460  ·  view source on GitHub ↗

parseManualTrigger parses manual invocation triggers

(input string)

Source from the content-addressed store, hash-verified

412
413// parseManualTrigger parses manual invocation triggers
414func parseManualTrigger(input string) (*TriggerIR, error) {
415 tokens := strings.Fields(input)
416 if len(tokens) == 0 {
417 return nil, nil
418 }
419
420 if tokens[0] == "manual" {
421 ir := &TriggerIR{
422 AdditionalEvents: map[string]any{
423 "workflow_dispatch": nil,
424 },
425 }
426
427 // Check for input specification: "manual with input <name>"
428 if len(tokens) >= 4 && tokens[1] == "with" && tokens[2] == "input" {
429 inputName := tokens[3]
430 triggerParserLog.Printf("Parsed manual trigger with input: %s", inputName)
431 ir.AdditionalEvents["workflow_dispatch"] = map[string]any{
432 "inputs": map[string]any{
433 inputName: map[string]any{
434 "description": "Input for " + inputName,
435 "required": false,
436 "type": "string",
437 },
438 },
439 }
440 } else {
441 triggerParserLog.Print("Parsed manual trigger (workflow_dispatch)")
442 }
443
444 return ir, nil
445 }
446
447 if len(tokens) >= 3 && tokens[0] == "workflow" && tokens[1] == "completed" {
448 // "workflow completed <workflow-name>"
449 workflowName := strings.Join(tokens[2:], " ")
450 return &TriggerIR{
451 Event: "workflow_run",
452 Types: []string{"completed"},
453 Filters: map[string]any{
454 "workflows": []string{workflowName},
455 },
456 }, nil
457 }
458
459 return nil, nil
460}
461
462// parseCommentTrigger parses comment triggers
463func parseCommentTrigger(input string) (*TriggerIR, error) {

Callers 1

ParseTriggerShorthandFunction · 0.85

Calls 2

PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected