mamba-org / setup-micromamba

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

Use js-yaml for environment-name parsing #82

Closed pavelzw closed 1 year ago

pavelzw commented 1 year ago

Fixes #81

Before, the environment-name was parsed using regex. Then, because of #78, we switched to a regex that also includes the line start, i.e., ^name:\s*(.*) instead of name:\s*(.*). This apparently doesn't work because the newlines %0A are not recognized by string.match.

We now switch to yaml parsing with js-yaml. This now also reads environment files correctly that have inline comments

name: myenv # this is a comment that doesn't belong to the name
dependencies: 
  - python
  - ...

Conda environment files also support jinja2, see here. This is out of scope for this project since adding a whole new yaml-conda parser in JS is too much effort and technical debt for just letting setup-micromamba infer the name of the environment. For these use cases, provide a custom environment-name as indicated by the error message.