diff --git a/CHANGELOG.md b/CHANGELOG.md index 7deec98c..527622f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Add ability to declare an included Taskfile as optional + ([#519](https://github.com/go-task/task/issues/519), [#552](https://github.com/go-task/task/pull/552)). - Add support for including Taskfiles in the home directory by using `~` ([#539](https://github.com/go-task/task/issues/539), [#557](https://github.com/go-task/task/pull/557)). diff --git a/docs/usage.md b/docs/usage.md index dd4827e7..c3b49340 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -166,6 +166,7 @@ includes: tests: taskfile: ./tests/Taskfile.yml optional: true + tasks: greet: cmds: diff --git a/taskfile/read/taskfile.go b/taskfile/read/taskfile.go index 65fbaa81..5ca194a3 100644 --- a/taskfile/read/taskfile.go +++ b/taskfile/read/taskfile.go @@ -60,10 +60,10 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) { } info, err := os.Stat(path) - if err != nil && includedTask.Optional { - return nil - } if err != nil { + if includedTask.Optional { + return nil + } return err } if info.IsDir() {