Skip to content

feat(includes): add only field to limit which tasks are included#2838

Draft
JakesMD wants to merge 1 commit into
go-task:mainfrom
JakesMD:feat-task-include
Draft

feat(includes): add only field to limit which tasks are included#2838
JakesMD wants to merge 1 commit into
go-task:mainfrom
JakesMD:feat-task-include

Conversation

@JakesMD
Copy link
Copy Markdown

@JakesMD JakesMD commented May 14, 2026

What changed

  • Added only field to includes as the inverse of excludes:
    includes:
      shared:
        taskfile: shared.yml
        only: [foo, baa]
  • Added tests
  • Updated guide.md, schema.md and schema.json

Use cases

  • include specific task from a "third party" or even a remote taskfile
  • avoid having to keep updating excludes whenever tasks are added to included taskfile
  • most useful when internal: false and the included tasks are part of the "public API"

Disclosure

@JakesMD
Copy link
Copy Markdown
Author

JakesMD commented May 14, 2026

Hi! I was wondering if there's a specific reason this hasn't been implemented before. When you only want to include a small subset of tasks from a larger taskfile, an only option makes more sense than a long excludes list.

You could split the included taskfile into multiple smaller ones, but for remote taskfiles that might not be an option. And when multiple taskfiles depend on an overlapping subset of tasks, that doesn't work either. The included taskfile also shouldn't need to know how it's being used, so even filtering by prefix or glob pattern isn't a good fit.

I'm not sure about the field name only. Other options could be includes, select(s) or subset.

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