mamba-org / setup-micromamba

GitHub Action to set up micromamba
MIT License
105 stars 16 forks source link

Auto-activating environment does not work when --name argument was passed to environment activation #71

Closed JohannesWiesner closed 1 year ago

JohannesWiesner commented 1 year ago

I use the following commands to specify a name for an environment that I want to create using a .yml file:

    - name: setup micromamba and solve environment
      uses: mamba-org/setup-micromamba@v1
      with:
        environment-file: environment.yml
        create-args: --name test_micromamba

The .yml file already has a name: csp_surname_name attribute that I explicitly want to overwrite using the --name argument in create-args:. Everything works fine and the name gets overwritten, but when the workflow reaches the "auto-activation" step it seems to not be aware of the new name but uses the one in .yml file. Of course, an environment with this name does not exist at this point so the workflow crashes here:

image

jonashaag commented 1 year ago

Maybe we can parse the micromamba output to read the environment name/path

pavelzw commented 1 year ago

There is a method that determines the environment name based on the input parameters environment-file and environment-name, see here.

If you specify the --name in create-args, the action will not pick that up. What I suggest is that you just specify both environment-file and environment-name:

    - name: setup micromamba and solve environment
      uses: mamba-org/setup-micromamba@v1
      with:
        environment-file: environment.yml
        environment-name: test_micromamba

This should have your desired effect.

pavelzw commented 1 year ago

I'll close this issue. Feel free to reopen if you have further questions.