Skip to content

feat(taskfile): load local Taskfile overrides automatically - #3079

Draft
vmaerten wants to merge 7 commits into
mainfrom
override
Draft

vmaerten wants to merge 7 commits into
mainfrom
override

Conversation

@vmaerten

Copy link
Copy Markdown
Member

Summary

Customising a shared Taskfile locally today means copying the whole file over a .dist variant (see #1873). When Task discovers the root Taskfile itself, it now also loads an optional Taskfile.override.yml next to it: vars and env merge by key with the override winning, tasks are added or replaced whole, and any other root key is an error. Naming the file with --taskfile skips the override; included, remote and stdin Taskfiles never load one.

Reviewer decision: tasks are replaced whole rather than merged field by field, so #1873's own example (overriding only a task's env) needs the value moved to a variable. The JSON schema is not covered yet: editors won't recognise Taskfile.override.yml until SchemaStore maps it, and the main schema would accept keys the override rejects.

Test plan

  • TestAutomaticOverride (golden, testdata/override): discovery, subdirectory with a stray invalid override, -t file vs -t directory, TASKFILE/ROOT_TASKFILE for an added task.
  • taskfile/override_test.go: merge semantics and ordering, override name priority, decode/version/forbidden-key errors, unreadable override, override applied before includes and conflict with an included task, remote and stdin roots ignored.
  • TestAutomaticOverrideGlobal: --global loads the override from the home directory.
  • Manual: check the new "Customize a Taskfile locally" section renders correctly on the docs site.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant