Skip to content

Working directory resolved incorrectly for nested includes #2056

@Diaphteiros

Description

@Diaphteiros

Description

Setup

./
├── Taskfile.yaml
└── common/
    ├── Taskfile.yaml
    └── tasks-development.yaml

The main Taskfile imports the one from the common subdirectory, which imports the tasks-development.yaml one.

Taskfiles

Taskfile.yaml

version: 3

includes:
  shared:
    taskfile: common
    flatten: true

common/Taskfile.yaml

version: 3

includes:
  dev:
    taskfile: tasks-development.yaml

tasks:
  pwd:
    desc: Print the current working directory.
    cmds:
      - pwd

common/tasks-development.yaml

version: 3

tasks:
  pwd:
    desc: Print the current working directory.
    cmds:
    - pwd

Expected Behavior

> task pwd
task: [pwd] pwd
/var/folders/b8/g43jjlg51gs4h13yf49sjmjm0000gn/T/tmp.6yctrFQfZM/tasktest

> task dev:pwd
task: [dev:pwd] pwd
/var/folders/b8/g43jjlg51gs4h13yf49sjmjm0000gn/T/tmp.6yctrFQfZM/tasktest

Actual Behavior

Tasks from the tasks-development.yaml Taskfile use the common subdirectory as working directory.

> task pwd
task: [pwd] pwd
/var/folders/b8/g43jjlg51gs4h13yf49sjmjm0000gn/T/tmp.6yctrFQfZM/tasktest

> task dev:pwd
task: [dev:pwd] pwd
/var/folders/b8/g43jjlg51gs4h13yf49sjmjm0000gn/T/tmp.6yctrFQfZM/tasktest/common

I tried to set dir on various includes, but neither . nor {{.ROOT_DIR}} seem to have any effect on this issue.

Version

v3.41.0

Operating system

macOS (darwin/arm64)

Experiments Enabled

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions