Skip to content
Discussion options

You must be logged in to vote

Yes. Include paths are passed through Task's Go-template renderer before Task resolves them, and environment variables are part of that template context. Your conditional can therefore work as written, with two practical adjustments: quote the whole scalar and make the CI test explicit.

version: '3'

includes:
  example: '{{ if eq .CI "true" }}https://raw.githubusercontent.com/example/taskfiles/<pinned-commit>/example.yml{{ else }}../taskfiles/example.yml{{ end }}'

Then:

# local
task example:some-task

# CI
CI=true task --yes example:some-task

Why this works on current Task: while reading includes, Task merges the process environment with Taskfile variables, then calls templater.Replace(i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@standardloop
Comment options

Answer selected by standardloop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants