Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.ROOT_TASKFILE returns the root directory instead of the file #1706

Open
cbrown1234 opened this issue Jul 2, 2024 · 1 comment · May be fixed by #1708
Open

.ROOT_TASKFILE returns the root directory instead of the file #1706

cbrown1234 opened this issue Jul 2, 2024 · 1 comment · May be fixed by #1708
Labels
area: templating Changes related to the templating engine. type: bug Something not working as intended.

Comments

@cbrown1234
Copy link

  • Task version: v3.38.0 (h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo=)
  • Operating system: "Ubuntu 22.04.4 LTS (on WSL2)
  • Experiments enabled: N/A
❯ cat Taskfile.yml
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'

tasks:
  who-am-i:
    cmds:
      - 'echo "Working dir: {{.USER_WORKING_DIR}}"'
      - 'echo "Task: {{.TASK}}"'
      - 'echo "Taskfile: {{.TASKFILE}}"'
      - 'echo "Root Taskfile: {{.ROOT_TASKFILE}}"'

❯ task who-am-i
task: [who-am-i] echo "Working dir: /home/chris/repos/repo-tools-playground"
Working dir: /home/chris/repos/repo-tools-playground
task: [who-am-i] echo "Task: who-am-i"
Task: who-am-i
task: [who-am-i] echo "Taskfile: /home/chris/repos/repo-tools-playground/Taskfile.yml"
Taskfile: /home/chris/repos/repo-tools-playground/Taskfile.yml
task: [who-am-i] echo "Root Taskfile: /home/chris/repos/repo-tools-playground"
Root Taskfile: /home/chris/repos/repo-tools-playground

I would have expected:

Root Taskfile: /home/chris/repos/repo-tools-playground/Taskfile.yml

(I searched for ROOT_TASKFILE in the issues and didn't see any related issues)

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Jul 2, 2024
@cbrown1234
Copy link
Author

It seems it might not be just in the root task file, but more general

❯ ll --recursive
.:
total 8.0K
-rw-r--r-- 1 chris chris  143 Jul  2 23:23 Taskfile.yml
drwxr-xr-x 2 chris chris 4.0K Jul  2 23:22 subdir1/

./subdir1:
total 4.0K
-rw-r--r-- 1 chris chris 285 Jul  2 23:05 LocalTaskfile.yml

❯ cat Taskfile.yml
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'

includes:
  local:
    taskfile: "./subdir1/LocalTaskfile.yml"

❯ cat subdir1/LocalTaskfile.yml
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'

tasks:
  who-am-i:
    cmds:
      - 'echo "Working dir: {{.USER_WORKING_DIR}}"'
      - 'echo "Task: {{.TASK}}"'
      - 'echo "Taskfile: {{.TASKFILE}}"'
      - 'echo "Root Taskfile: {{.ROOT_TASKFILE}}"'

❯ task local:who-am-i
task: [local:who-am-i] echo "Working dir: /home/chris/repos/repo-tools-playground"
Working dir: /home/chris/repos/repo-tools-playground
task: [local:who-am-i] echo "Task: local:who-am-i"
Task: local:who-am-i
task: [local:who-am-i] echo "Taskfile: /home/chris/repos/repo-tools-playground/subdir1/LocalTaskfile.yml"
Taskfile: /home/chris/repos/repo-tools-playground/subdir1/LocalTaskfile.yml
task: [local:who-am-i] echo "Root Taskfile: /home/chris/repos/repo-tools-playground"
Root Taskfile: /home/chris/repos/repo-tools-playground

@cbrown1234 cbrown1234 changed the title .ROOT_TASKFILE in root taskfile returns the root directory instead .ROOT_TASKFILE returns the root directory instead of the file Jul 2, 2024
@vmaerten vmaerten added type: bug Something not working as intended. area: templating Changes related to the templating engine. and removed state: needs triage Waiting to be triaged by a maintainer. labels Jul 3, 2024
@vmaerten vmaerten linked a pull request Jul 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: templating Changes related to the templating engine. type: bug Something not working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants