in workflow.go [846:886]
func readWorkflow(file string, w *Workflow) (derr DError) {
data, err := ioutil.ReadFile(file)
if err != nil {
return newErr("failed to read workflow file", err)
}
w.workflowDir, err = filepath.Abs(filepath.Dir(file))
if err != nil {
return newErr("failed to get absolute path of workflow file", err)
}
if err := json.Unmarshal(data, &w); err != nil {
return newErr("failed to unmarshal workflow file", JSONError(file, data, err))
}
if w.OAuthPath != "" && !filepath.IsAbs(w.OAuthPath) {
w.OAuthPath = filepath.Join(w.workflowDir, w.OAuthPath)
}
for name, step := range w.Steps {
step.name = name
step.w = w
if step.SubWorkflow != nil &&
step.SubWorkflow.Path != "" &&
!hasVariableDeclaration(step.SubWorkflow.Path) {
step.SubWorkflow.Workflow, derr = w.NewSubWorkflowFromFile(step.SubWorkflow.Path)
} else if step.IncludeWorkflow != nil &&
step.IncludeWorkflow.Path != "" &&
!hasVariableDeclaration(step.IncludeWorkflow.Path) {
step.IncludeWorkflow.Workflow, derr = w.NewIncludedWorkflowFromFile(step.IncludeWorkflow.Path)
} else {
continue
}
if derr != nil {
return derr
}
}
return nil
}