PR: Allow null channels in file to not crash setup. #120
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an edge case where having
channels
in an environment filebut an empty list, and
channels
missing from the GHA options/keysreturns an unhelpful error message:
Error: Cannot read property 'join' of null
I've setup an example here which runs through all the permutations of
channels
keys being set, missing, and nulled:https://github.com/Lnaden/ghatesting/runs/1538195898?check_suite_focus=true
This PR attempts to fix that by relaxing the strict equals in
setup.ts
from
if (condaConfig["channels"] === "" && channels !== undefined) {
to
if (condaConfig["channels"] === "" && channels != null) {
which should allow
channels != null
to catch bothnull
andundefined
forchannels
. I also attempted to add an example to theGitHub Actions tests (Example 9) to test this edge case specifically.
A few comments to this PR:
channels
list with theconda
client to create an environment, it works fine and just defaults to whatever theconda
is configured to. In my example above, setting no channels in either the file or the GHA keys works fine and pulls from thedefault
channel.package.json
andpackage-lock.json
files may not need to be merged with this? I followed the instructions on theCONTRIBUTING.md
file and these wound up getting changed. Is that expected (e.g. 11k lines on package-lock)?