Skip to content

requires not evaluated before dynamic variables #1970

@hans-d

Description

@hans-d

Description

Have a task that defines a `requires: { vars: [] }', and additionallyuse a dynamic variable.

The dynamic variables is resolved before the requires are checked.

Version

Task version: v3.40.1 (h1:Q/TjPh5SAI+XK2fBravDPZXNGm6mvnwrLJqCXfhZ3Wc=)

Operating system

Linux

Experiments Enabled

No response

Example Taskfile

version: '3'

tasks:
  test-ok:
    desc: Fails correctly
    requires:
      vars: [ FOO ]
    vars:
      BAR: '{{.FOO}}'
    cmds:
      - echo Got {{.FOO}} {{.BAR }}

  test-fail:
    desc: Should fail, but already executes sh `Command "echo '' && false" failed: exit status 1`
    requires:
      vars: [ FOO ]
    vars:
      BAR:
        sh: echo '{{.FOO}}' && false
    cmds:
      - echo Got {{.FOO}} {{.BAR }}

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions