feat(taskfile): skip var merge when SCOPED_INCLUDES enabled

When the SCOPED_INCLUDES experiment is enabled, variables from included
Taskfiles are no longer merged globally. They remain in their original
Taskfile within the DAG.

Exception: flatten includes still merge variables globally to allow
sharing common variables across multiple Taskfiles.
This commit is contained in:
Valentin Maerten
2025-12-26 21:02:33 +01:00
parent da927ad5fe
commit 0dbeaaf187
3 changed files with 14 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/go-task/task/v3/internal/logger"
"github.com/go-task/task/v3/internal/output"
"github.com/go-task/task/v3/internal/version"
"github.com/go-task/task/v3/experiments"
"github.com/go-task/task/v3/taskfile"
"github.com/go-task/task/v3/taskfile/ast"
)
@@ -105,7 +106,7 @@ func (e *Executor) readTaskfile(node taskfile.Node) error {
return err
}
e.Graph = graph
if e.Taskfile, err = graph.Merge(); err != nil {
if e.Taskfile, err = graph.Merge(experiments.ScopedIncludes.Enabled()); err != nil {
return err
}
return nil