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

Function applyStopAfterModifications

pkg/cli/add_command.go:604–634  ·  view source on GitHub ↗
(content string, opts AddOptions)

Source from the content-addressed store, hash-verified

602}
603
604func applyStopAfterModifications(content string, opts AddOptions) (string, error) {
605 // Handle stop-after field modifications
606 if opts.NoStopAfter {
607 cleanedContent, err := RemoveFieldFromOnTrigger(content, "stop-after")
608 if err != nil {
609 if opts.Verbose {
610 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to remove stop-after field: %v", err)))
611 }
612 return content, nil
613 }
614 if opts.Verbose {
615 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Removed stop-after field from workflow"))
616 }
617 return cleanedContent, nil
618 }
619 if opts.StopAfter == "" {
620 return content, nil
621 }
622
623 updatedContent, err := SetFieldInOnTrigger(content, "stop-after", opts.StopAfter)
624 if err != nil {
625 if opts.Verbose {
626 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to set stop-after field: %v", err)))
627 }
628 return content, nil
629 }
630 if opts.Verbose {
631 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Set stop-after field to: "+opts.StopAfter))
632 }
633 return updatedContent, nil
634}
635
636func trackAndWriteWorkflowFile(destFile string, content string, fileExists bool, opts AddOptions, tracker *FileTracker) error {
637 if tracker != nil {

Callers 1

Calls 4

FormatWarningMessageFunction · 0.92
FormatInfoMessageFunction · 0.92
RemoveFieldFromOnTriggerFunction · 0.85
SetFieldInOnTriggerFunction · 0.85

Tested by

no test coverage detected