Rozbicie dużego Taskfile.yml na mniejsze pliki za pomocą include.
project/
├── Taskfile.yml # Main file — includes + local overrides
├── tasks/
│ ├── build.yml # Build tasks + variables
│ ├── deploy.yml # Deploy tasks + environments (prefix: deploy)
│ └── test.yml # Test/lint tasks
└── README.md
# Taskfile.yml
include:
- path: ./tasks/build.yml # Merge tasks as-is
- path: ./tasks/deploy.yml
prefix: deploy # Tasks become: deploy-local, deploy-staging, deploy-prod
- path: ./tasks/test.yml # Simple string path also works- Tasks — included first, local Taskfile wins on conflict
- Variables — included first, local wins
- Environments — included first, local wins
- Prefix — optional, prepends
{prefix}-to included task names
| Section | Merged | Local Wins |
|---|---|---|
tasks |
✅ | ✅ |
variables |
✅ | ✅ |
environments |
✅ | ✅ |
pipeline |
❌ (main only) | — |
compose |
❌ (main only) | — |
# All included tasks are available as if defined locally
taskfile list
taskfile run build # from tasks/build.yml
taskfile run test # from tasks/test.yml
taskfile run lint # from tasks/test.yml
taskfile run deploy-local # from tasks/deploy.yml (prefixed)
taskfile run deploy-staging # from tasks/deploy.yml (prefixed)
taskfile run deploy-prod # from tasks/deploy.yml (prefixed)
taskfile run all # local task, depends on included tasks
# Validate (includes are resolved during parsing)
taskfile validate# String shorthand
include:
- ./tasks/build.yml
# Dict with path
include:
- path: ./tasks/build.yml
# Dict with prefix
include:
- path: ./tasks/deploy.yml
prefix: deploy
# Dict with file (alias for path)
include:
- file: ./tasks/test.yml- Monorepo — each service has its own tasks file
- Shared tasks — common CI/test tasks reused across projects
- Team separation — infra team owns deploy.yml, dev team owns build.yml
- Large Taskfile — >100 lines → split by concern