Included Taskfile watch: true not working
I have a root Taskfile, that includes a Taskfile from a folder named watch
For simplicity, my tasks:
Taskfile.yml
version: "3"
interval: 500ms
dotenv: ['.env.local', '.env.dev']
includes:
watch:
taskfile: ./watch
aliases: [w]
watch/Taskfile.yml
version: "3"
tasks:
build:*:
watch: true
sources:
- '${PROJECTS}/*-bin/*.go'
cmds:
- echo "hello world"
This watcher works if I put it in the root of my Taskfile set. But the subfolder task does not watch, for reasons unclear to me, I couldn't find any documentation about it, and I would expect that the $(PROJECTS), which is a full absolute path in .env.local, should/would "just work" :tm:?
- Task version: 3.38.0
- Operating system: MacOS Sonoma 14.6.1
- Experiments enabled: No
I'm experiencing the same issue.
There are two files: Taskfile.yaml and watch/Taskfile.yaml.
Including with this declaration:
includes:
watch:
dir: ./watch
taskfile: ./watch/Taskfile.yaml
When I run task from watch/Taskfile.yaml directly watch is starting:
❯ task -t watch/Taskfile.yaml build
task: Started watching for tasks: build
task: [build] go build main.go
...
But when I run from the main Taskfile.yaml the watch step is skipped:
❯ task watch:build
task: [watch:build] go build main.go
...
However, I can force it with task -w watch:build that makes it to work well:
❯ task watch:build -w
task: Started watching for tasks: watch:build
task: [watch:build] go build main.go
...