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

Included vars not expanded in global vars #454

Open
b4nst opened this issue Mar 21, 2021 · 2 comments
Open

Included vars not expanded in global vars #454

b4nst opened this issue Mar 21, 2021 · 2 comments
Labels
area: variables Changes related to variables. type: bug Something not working as intended.

Comments

@b4nst
Copy link

b4nst commented Mar 21, 2021

  • Task version: 3.2.2
  • Operating System: macOS

Example Taskfile showing the issue

Taskfile.yml

# https://taskfile.dev

version: '3'

includes:
  msg: ./include.yml

vars:
  GREETING: '{{.MSG}}'

tasks:
  default:
    cmds:
      - echo "{{.GREETING}}"
      - echo "{{.MSG}}"

include.yml

# https://taskfile.dev

version: '3'

vars:
  MSG: Hello, World!

output

➜  task                                                                                                                                                                                                                                                                   
task: echo ""

task: echo "Hello, World!"
Hello, World!
@b4nst b4nst added the type: bug Something not working as intended. label Mar 21, 2021
@b4nst b4nst changed the title Included vars nor expanded in global vars Included vars not expanded in global vars Mar 24, 2021
@weeping-somnambulist
Copy link

Due to variable scoping this would not be the desired behavior. That said I think there should be a way to pass data from included task to the calling task, however that would be a feature request that needs an issue on it's own.

@andreynering I believe that this is EXPECTED BEHAVIOR and should be closed.

@andreynering
Copy link
Member

Hi @b4nst, thanks for reporting this!

This happens because the variables are interpolated before includes are read, but given your use case, I think it may make sense to try to fix this, specially if more people think this would be useful.

@andreynering andreynering added the area: variables Changes related to variables. label Aug 1, 2021
kesslerdev pushed a commit to kesslerdev/task that referenced this issue Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: variables Changes related to variables. type: bug Something not working as intended.
Projects
None yet
Development

No branches or pull requests

3 participants