Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honour the global-level 'run: once' setting in an included Taskfile #1738

Open
jlucktay opened this issue Aug 6, 2024 · 0 comments
Open
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@jlucktay
Copy link

jlucktay commented Aug 6, 2024

Given two Taskfiles in a project: one at the root and the other in a subdirectory.
If the subdirectory Taskfile has run: once set at the global/top level (rather than set explicitly per-task) and the root Taskfile includes the subdirectory Taskfile, the task calls from the root directory can potentially run the subdirectory Taskfile tasks more than once.

/Taskfile.yaml:

version: '3'

includes:
  subdir: ./subdir/Taskfile.yaml

tasks:
  reproduce:
    deps:
      - task: subdir:once-only
      - task: subdir:once-only

/subdir/Taskfile.yaml:

version: '3'

run: once

tasks:
  once-only:
    cmd: echo "Once"

  several:
    deps:
      - task: once-only
      - task: once-only
      - task: once-only

From inside the subdirectory, run: once works fine:

$ cd subdir
$ task several
task: [once-only] echo "Once"
Once

From the root directory, the subdirectory Taskfile's run: once setting has no effect:

$ task reproduce
task: [subdir:once-only] echo "Once"
task: [subdir:once-only] echo "Once"
Once
Once

These other issues/PRs seem similar/relevant, but distinct from this particular situation:

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants