feat: can exclude task from being included (#1859)

This commit is contained in:
Valentin Maerten
2024-12-30 10:09:28 +01:00
committed by GitHub
parent 9727eef476
commit 5f1d46c770
8 changed files with 120 additions and 11 deletions

View File

@@ -56,6 +56,12 @@ func (t1 *Tasks) Merge(t2 Tasks, include *Include, includedTaskfileVars *Vars) e
// taskfile are marked as internal
task.Internal = task.Internal || (include != nil && include.Internal)
taskName := name
// if the task is in the exclude list, don't add it to the merged taskfile and early return
if slices.Contains(include.Excludes, name) {
return nil
}
if !include.Flatten {
// Add namespaces to task dependencies
for _, dep := range task.Deps {