Install action does not honor working-directory
The install action does not appear to honor the working-directory configured in a workflow.
In this repro project I set up, I have a .tool-versions file in the root that configures one version of a tool:
https://github.com/mdobosz-isp/asdf-actions-wrong-dir/blob/d448ef42593a21fef79927bd5e433f2f523b3888/.tool-versions#L1
I also have a subdirectory that sets a different version of the tool:
https://github.com/mdobosz-isp/asdf-actions-wrong-dir/blob/d448ef42593a21fef79927bd5e433f2f523b3888/helm3/.tool-versions#L1
When I execute a workflow that uses the non-default working directory: https://github.com/mdobosz-isp/asdf-actions-wrong-dir/blob/26d01bec1e7a7b48c5270acce978db41a4e2a3a4/.github/workflows/repro.yml#L22-L34 the action still appears to run in the root working directory, resulting in the wrong version being installed and invocations of the tool failing when the asdf shim tries to load the correct version.
This fails for workflows using the v1.0.0 and master versions of the action.
I would expect that the asdf install command was executed in the appropriate working directory.
The current workaround is to use the plugins-add action (which will also run setup) and run asdf install as a freeform step.
This is also a good idea. Would you like to tackle this?
Sorry, I've moved on to working on something else and probably won't have enough spare time to tackle this.
Got it, that's okay.
Ran into this today too. When looking at the raw logs I don't even understand how to get it to install the .tool-versions
First step list the files in the working-directory while the next step tries to install asdf and fails because it defaults to /usr/bin/git ?
2021-09-05T23:16:41.1760059Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2021-09-05T23:16:41.1760582Z ##[endgroup]
2021-09-05T23:16:41.1857137Z .
2021-09-05T23:16:41.1857949Z ..
2021-09-05T23:16:41.1859055Z .tool-versions
2021-09-05T23:16:41.1859601Z backend.tf
2021-09-05T23:16:41.1860202Z common.auto.tfvars
2021-09-05T23:16:41.1860830Z local.tf
2021-09-05T23:16:41.1861472Z output.tf
2021-09-05T23:16:41.1862004Z provider.tf
2021-09-05T23:16:41.1862540Z redirect.tf
2021-09-05T23:16:41.1863102Z variables.tf
2021-09-05T23:16:41.1863692Z versions.tf
2021-09-05T23:16:41.1864182Z zones.tf
2021-09-05T23:16:41.1920853Z ##[group]Run asdf-vm/actions/install@v1
2021-09-05T23:16:41.1921329Z with:
2021-09-05T23:16:41.1921794Z asdf_branch: master
2021-09-05T23:16:41.1922201Z ##[endgroup]
2021-09-05T23:16:41.5451373Z Cloning asdf into ASDF_DIR: /home/runner/.asdf
2021-09-05T23:16:41.5464765Z [command]/usr/bin/git clone --depth 1 --branch master https://github.com/asdf-vm/asdf.git /home/runner/.asdf
2021-09-05T23:16:41.5466239Z Cloning into '/home/runner/.asdf'...
2021-09-05T23:16:41.5472876Z ##[error]Action failed with error Error: ENOENT: no such file or directory, open '.tool-versions'
2021-09-05T23:16:41.5579448Z Post job cleanup.
You know, I just ran into this today as well. I don't suppose there's something on the roadmap to address this? Really, if I could specify a path to the .tool-versions file, that would suffice.
hey 👋 we are looking to implement asdf in a large monorepo for terraform version management. being abe to specify which .tool-versions file would be a great plus :)