diff --git a/.github/workflows/test_options.yml b/.github/workflows/test_options.yml index 7002ca0d..f8bf6584 100644 --- a/.github/workflows/test_options.yml +++ b/.github/workflows/test_options.yml @@ -111,6 +111,21 @@ jobs: extra-specs: | xtensor channels: conda-forge,blah + - name: check channels are correct + run: | + CHANNEL_OPT=$(micromamba config get channels) + echo $CHANNEL_OPT + if [[ "$CHANNEL_OPT" != *"conda-forge"* ]]; then + exit 1; + fi + if [[ "$CHANNEL_OPT" != *"blah"* ]]; then + exit 1; + fi + if [[ "${{ matrix.environment-file }}" != "false" ]]; then + if [[ "$CHANNEL_OPT" != *"defaults"* ]]; then + exit 1; + fi + fi test_environment_without_name: name: "Test environment.yml without name: attribute" diff --git a/dist/main/index.js b/dist/main/index.js index 37fa8a64..07fb9035 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -63175,13 +63175,17 @@ function makeCondarcOpts (inputs, extraChannels) { if (inputs.channelAlias) { condarcOpts.channel_alias = inputs.channelAlias } - const channels = - inputs.channels && extraChannels - ? inputs.channels + ',' + extraChannels.join(', ') - : inputs.channels || extraChannels?.join(', ') + let channels = [] + if (inputs.channels) { + channels = inputs.channels.split(',').map(s => s.trim()) + } + if (extraChannels) { + channels.push.apply(channels, extraChannels) + } if (channels) { - condarcOpts.channels = channels.split(',').map(s => s.trim()) + condarcOpts.channels = channels } + const moreOpts = yaml.safeLoad(inputs.condaRcOptions) if (moreOpts) { condarcOpts = { ...condarcOpts, ...moreOpts } @@ -63378,7 +63382,7 @@ async function main () { } // Setup .condarc - const condarcOpts = makeCondarcOpts(inputs, envYaml?.extraChannels) + const condarcOpts = makeCondarcOpts(inputs, envYaml?.channels) if (inputs.condaRcFile) { fs.copyFileSync(inputs.condaRcFile, PATHS.condarc) } diff --git a/index.js b/index.js index e828b04e..207125f9 100644 --- a/index.js +++ b/index.js @@ -243,13 +243,17 @@ function makeCondarcOpts (inputs, extraChannels) { if (inputs.channelAlias) { condarcOpts.channel_alias = inputs.channelAlias } - const channels = - inputs.channels && extraChannels - ? inputs.channels + ',' + extraChannels.join(', ') - : inputs.channels || extraChannels?.join(', ') + let channels = [] + if (inputs.channels) { + channels = inputs.channels.split(',').map(s => s.trim()) + } + if (extraChannels) { + channels.push.apply(channels, extraChannels) + } if (channels) { - condarcOpts.channels = channels.split(',').map(s => s.trim()) + condarcOpts.channels = channels } + const moreOpts = yaml.safeLoad(inputs.condaRcOptions) if (moreOpts) { condarcOpts = { ...condarcOpts, ...moreOpts } @@ -446,7 +450,7 @@ async function main () { } // Setup .condarc - const condarcOpts = makeCondarcOpts(inputs, envYaml?.extraChannels) + const condarcOpts = makeCondarcOpts(inputs, envYaml?.channels) if (inputs.condaRcFile) { fs.copyFileSync(inputs.condaRcFile, PATHS.condarc) } diff --git a/package.json b/package.json index 8f7f1aa8..5d86364c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "build": "ncc build index.js -o dist/main --license licenses.txt && ncc build post.js -o dist/post --license licenses.txt && node generate-inputs-docs.js", "build-readme": "node generate-inputs-docs.js", - "lint": "standard *.js" + "lint": "standard *.js --fix" }, "repository": { "type": "git",