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

Add VCS_ROOT variable #898

Closed
sdemura opened this issue Oct 14, 2022 · 2 comments
Closed

Add VCS_ROOT variable #898

sdemura opened this issue Oct 14, 2022 · 2 comments
Labels
area: variables Changes related to variables.

Comments

@sdemura
Copy link

sdemura commented Oct 14, 2022

On top of ROOT_DIR and TASKFILE_DIR being immensely useful, it would be awesome to have a built in VCS_ROOT variable.

I can usually get around this in my taskfiles by defining my own:

vars:
  GIT_ROOT:
    sh: git rev-parse --show-toplevel

But this falls apart if trying to use that variable in includes. For example:

includes:
  foo: '{{.GIT_ROOT}}/.tasks/bar.yml`

vars:
  GIT_ROOT:
    sh: git rev-parse --show-toplevel
@andreynering andreynering added the area: variables Changes related to variables. label Aug 10, 2023
@andreynering
Copy link
Member

Hi @sdemura,

I don't plan do implement this at the moment. I think ROOT_DIR is what most people need, and people can always create a custom variable (as your example).

@andreynering andreynering closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
@dstadelm
Copy link

dstadelm commented Nov 2, 2023

Actually I think that would be low hanging fruit but there is a workaround for those who need this feature

What I've done (using git)

vars:
  VCS_ROOT:
    sh: git rev-parse --show-toplevel
  DOC_ROOT: '{{.VCS_ROOT}}/doc'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: variables Changes related to variables.
Projects
None yet
Development

No branches or pull requests

3 participants