-
-
Notifications
You must be signed in to change notification settings - Fork 763
Description
In my project I'd like to have a file with shared tasks (Tasklib.yaml) included in the Taskfiles of subdirectories. I then want to include the subdirectory Taskfiles in my root directory Taskfile. The project structure looks like this:
.
├── subdir/
│ └── Taskfile.yaml
├── Taskfile.yaml
└── Tasklib.yamlThe root Taskfile.yaml looks like this:
version: '3'
includes:
subdir:
taskfile: subdir/Taskfile.yaml
shared:
taskfile: Tasklib.yaml
tasks:
test: ls ; echoThe shared tasks Tasklib.yaml looks like this:
version: '3'
tasks:
shared-test: ls ; echoThe subdirectory Taskfile.yaml looks like this:
version: '3'
includes:
shared:
taskfile: ../Tasklib.yaml
flatten: true
tasks:
subdir-test: ls ; echoWhen I run task -a, this is the output:
❯ task -a
task: Available tasks for this project:
* test:
* shared:shared-test:
* subdir:shared-test:
* subdir:subdir-test: When I run all of the tasks, subdir:shared-test gives a different output, despite running from the same folder and not having the dir property set in the include.
task test ; task shared:shared-test ; task subdir:shared-test ; task subdir:subdir-test
task: [test] ls ; echo
Taskfile.yaml Tasklib.yaml subdir
task: [shared:shared-test] ls ; echo
Taskfile.yaml Tasklib.yaml subdir
task: [subdir:shared-test] ls ; echo
Taskfile.yaml
task: [subdir:subdir-test] ls ; echo
Taskfile.yaml Tasklib.yaml subdir
I'd expect these all to have the same output based on what the documentation states about the execution directory, but I guess having this circular include leads to a different output for the shared task when included from the subdirectory's Taskfile. Sorry if this has been posted before, but I couldn't identify an issue with this exact problem laid out. Please let me know if this is intended or not. Thank you!
- Task version: 3.39.2
- Operating system: macOS Sonoma 14.6.1
- Experiments enabled: false