func()

in schema/v1/step.go [181:206]


func (s *Step) compileScriptKeywordToStep() error {
	if s.Script == nil || *s.Script == "" {
		return nil
	}
	if s.Step != nil {
		return fmt.Errorf("the `script` keyword cannot be used with the `step` keyword")
	}
	if s.Action != nil && *s.Action != "" {
		return fmt.Errorf("the `script` keyword cannot be used with the `action` keyword")
	}
	if len(s.Inputs) != 0 {
		return fmt.Errorf("the `script` keyword cannot be used with `inputs`")
	}

	s.Step = &proto.Step_Reference{
		Protocol: proto.StepReferenceProtocol_dist,
		Path:     []string{"script"},
		Filename: "step.yml",
	}

	s.Inputs = map[string]any{
		"script": s.Script,
	}
	s.Script = nil
	return nil
}