task icon indicating copy to clipboard operation
task copied to clipboard

requires.env seem to run before dotenv files are loaded

Open G07cha opened this issue 2 years ago • 0 comments

  • Task version: 3.30.1
  • Operating system: MacOS
  • Experiments enabled: No

First of all, thanks for making such a neat tool, I found it very easy migrating to go-task from my archaic bash scripts. I did, however, run it one small issue with requires.env and dotenv task properties. When I load a variable from one of the files defined in dotenv array and try to verify that it's present by specifying it in requires.env it fails regardless if the variable is present in env file or not. This only happens when both properties are defined on a task level, when dotenv is defined at the root the check works as expected.

# Taskfile.yml
version: '3'

tasks:
  fail:
    dotenv: ['.env']
    requires:
      vars: [FOO]
    cmds:
      - echo "Works"
# .env
FOO="BAR"

G07cha avatar Oct 06 '23 08:10 G07cha