Skip to content

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

Closed

Description

@cbrown1234
  • 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)

Activity

  1. cbrown1234 commented on Jul 2, 2024

    @cbrown1234
    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
    
  2. changed the title [-].ROOT_TASKFILE in root taskfile returns the root directory instead[/-] [+].ROOT_TASKFILE returns the root directory instead of the file[/+] on Jul 2, 2024
  3. added
    area: templatingChanges related to the templating engine.
    and removed
    state: needs triageWaiting to be triaged by a maintainer.
    on Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: templatingChanges related to the templating engine.

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions