feat: add global preconditions at the taskfile level#2734
Draft
drichardson wants to merge 1 commit intogo-task:mainfrom
Draft
feat: add global preconditions at the taskfile level#2734drichardson wants to merge 1 commit intogo-task:mainfrom
drichardson wants to merge 1 commit intogo-task:mainfrom
Conversation
Adds a top-level `preconditions` key to Taskfiles that applies to all tasks. Preconditions from a parent taskfile are inherited by tasks in included taskfiles (propagated downward through the include hierarchy). Closes go-task#294 Assisted by AI Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #294
Summary
Adds a top-level
preconditionskey to Taskfiles that applies to all tasks before they run.Changes
taskfile/ast/taskfile.go— addPreconditionsfield toTaskfilestruct andUnmarshalYAMLtaskfile/ast/tasks.go— pass global preconditions throughTasks.Merge, prepending them to each task after deep copytaskfile/ast/graph.go— after full graph merge, prepend root taskfile's global preconditions to all tasksexecutor_test.go+ test fixtures — 6 new test cases covering: precondition met, precondition not met, inheritance by included tasks, interaction with task-level preconditionswebsite/src/docs/guide.md— new "Global preconditions" sectionwebsite/src/docs/reference/schema.md— newpreconditionsentry in Root Schemawebsite/src/public/schema.json—preconditionsadded to root taskfile properties