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

Wildcard arguments not respected in label distinction #2041

Open
MetalArend opened this issue Feb 5, 2025 · 1 comment
Open

Wildcard arguments not respected in label distinction #2041

MetalArend opened this issue Feb 5, 2025 · 1 comment
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@MetalArend
Copy link

Description

Given the Taskfile.yml below, I would expect task go to echo in no particular order go:* and 1 and go:* and 2, because of the label being overwritten pretty distinctly.
The docs state: "If you want to distinguish a task by any of its input variables, you can add those variables as part of the task's label, and it will be considered a different task."

task: [go:2-label] echo "go:*"
go:*
task: [go:2-label] echo "2"
2
task: [go:1-label] echo "go:*"
go:*
task: [go:1-label] echo "1"
1

Actual output:

task: [go:2-label] echo "go:*"
go:*
task: [go:2-label] echo "2"
2

Am I doing something wrong, or is there a better way to make sure each of those tasks is only run once, but always run.

Version

Task version: v3.41.0 (h1:giUddhe0XZLbEWIQ/MuTPipR9ek+teulIA5xf/2IHXg=

Operating system

Ubuntu

Experiments Enabled

No response

Example Taskfile

version: '3'

tasks:

  go:*:
    vars:
      NUMBER: '{{index .MATCH 0}}'
    label: '{{replace "*" .NUMBER .TASK}}-label'
    prefix: '{{replace "*" .NUMBER .TASK}}-prefix'
    cmds:
      - echo "{{.TASK}}"
      - echo "{{.NUMBER}}"
    run: once

  go:
    deps:
      - go:1
      - go:2
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Feb 5, 2025
@trulede
Copy link

trulede commented Feb 24, 2025

@MetalArend use run: when_changed rather than run: once.

https://taskfile.dev/usage/#limiting-when-tasks-run

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

3 participants