diff --git a/docs/usage.md b/docs/usage.md index 74dd3dee..78465424 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -468,7 +468,7 @@ Supported values for `run` passed into the task ```yaml -version: '3' +version: '3.7' tasks: default: cmds: diff --git a/task.go b/task.go index b4b9105b..35fed84d 100644 --- a/task.go +++ b/task.go @@ -152,8 +152,8 @@ func (e *Executor) Setup() error { v = 2.6 } - if v > 3.0 { - return fmt.Errorf(`task: Taskfile versions greater than v3.0 not implemented in the version of Task`) + if v > 3.7 { + return fmt.Errorf(`task: Taskfile versions greater than v3.7 not implemented in the version of Task`) } // Color available only on v3 @@ -227,13 +227,6 @@ func (e *Executor) Setup() error { } } - if v < 3 && e.Taskfile.Run != "" { - return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3`) - } - if e.Taskfile.Run == "" { - e.Taskfile.Run = "always" - } - if v <= 2.1 { err := errors.New(`task: Taskfile option "ignore_error" is only available starting on Taskfile version v2.1`) @@ -267,13 +260,24 @@ func (e *Executor) Setup() error { if err != nil { return err } + } + + if v < 3.7 { + if e.Taskfile.Run != "" { + return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3.7`) + } + for _, task := range e.Taskfile.Tasks { if task.Run != "" { - return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3`) + return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3.7`) } } } + if e.Taskfile.Run == "" { + e.Taskfile.Run = "always" + } + e.execution = make(map[string]context.Context) e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks)) diff --git a/testdata/run/Taskfile.yml b/testdata/run/Taskfile.yml index 026b570c..9a332780 100644 --- a/testdata/run/Taskfile.yml +++ b/testdata/run/Taskfile.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3.7' run: when_changed tasks: