diff --git a/taskfile/included_taskfile.go b/taskfile/included_taskfile.go index a0dd8866..332f986e 100644 --- a/taskfile/included_taskfile.go +++ b/taskfile/included_taskfile.go @@ -12,6 +12,7 @@ type IncludedTaskfile struct { Dir string Optional bool AdvancedImport bool + Vars *Vars } // IncludedTaskfiles represents information about included tasksfiles @@ -94,6 +95,7 @@ func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) err Taskfile string Dir string Optional bool + Vars *Vars } if err := unmarshal(&includedTaskfile); err != nil { return err @@ -102,5 +104,6 @@ func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) err it.Dir = includedTaskfile.Dir it.Optional = includedTaskfile.Optional it.AdvancedImport = true + it.Vars = includedTaskfile.Vars return nil } diff --git a/taskfile/read/taskfile.go b/taskfile/read/taskfile.go index 6d54f356..ce103d51 100644 --- a/taskfile/read/taskfile.go +++ b/taskfile/read/taskfile.go @@ -62,6 +62,7 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) { Dir: tr.Replace(includedTask.Dir), Optional: includedTask.Optional, AdvancedImport: includedTask.AdvancedImport, + Vars: includedTask.Vars, } if err := tr.Err(); err != nil { return err @@ -109,6 +110,12 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) { } for _, task := range includedTaskfile.Tasks { + if includedTask.Vars != nil { + if task.Vars == nil { + task.Vars = &taskfile.Vars{} + } + task.Vars.Merge(includedTask.Vars) + } if !filepath.IsAbs(task.Dir) { task.Dir = filepath.Join(includedTask.Dir, task.Dir) }