Closed sebastian-correa closed 1 month ago
One fix would be to run:
run: # set your config values here
if: steps.cached-poetry.outputs.cache-hit != 'true'
but I guess the better fix would be to figure out where the config is stored, and cache that 👍
Hi @sondrelg, do you mean that the user should figure this out and cache it, or do you mean that the action itself should be aware of this?
According to Poetry's docs, the config is stored in a different place according to the OS. In my local machine (a Mac), poetry
has no configs where they say they store them though.
I tried setting the env var POETRY_CONFIG_DIR
to ~/.local
in my install-poetry
step to see if it'd maybe work but, upon a rerun, the issue was still there. Maybe it's not enough to set POETRY_CONFIG_DIR="$INSTALL_PATH"
in this repo's main.sh
.
@zalun adding that would patch the issue (just as @sondrelg's suggestion would).
I think handling this in the action isn't trivial (if my suggestion above doesn't work, which I can't really test) and maybe changing the cache instructions would suffice. If @sondrelg agrees, I can open a PR adding his suggestion here
I think for the purposes of the docs here, @zalun's fix addresses this issue, so I'll close this for now 👍 Not sure if you agree with this @sebastian-correa - if not, could you elaborate a bit on what you'd want done?
Come to think of it, @zalun's suggestion wouldn't work in the case I proposed, would it? It's the same thing, the Action runs a poetry configure ...
to set the value of the virtualenv path, so it'd configure it only the first time it runs. However, upon needing to recreate the venv, poetry install
will install the venv in the default location.
To fix this at the action's level, I would figure out how to tell Poetry to store its configurations in a given directory (the same directory where the action installs Poetry itself) so that caching also brings over configs. Can you guide me through making changes and testing the action myself to see if I can figure out (and contribute) some fix?
In the meantime, I opened #154 with the changes you mentioned here, which seem to work in my case.
Hi! I'm using this action to install poetry like this:
As you can see, I'm caching both the poetry install and the venv creation. However, any runs after the one that creates the cache entry for the poetry install don't correctly set
virtualenvs-in-project
, so if I change my lock file, the venv install step fails to cache (because its using a cached poetry installation that hasn't been configured to install the venv in.venv
and installs it to the default location).How can this be fixed? For now it seems I have to disable the caching of installing poetry, or add a new intermediate step that runs the correct
poetry config
steps. Maybe we also need to cache the output ofpoetry config --list --local
?