Skip to content

Commit 87a13a6

Browse files
authored
use "channels" and not extraChannels (#82)
1 parent e198969 commit 87a13a6

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

.github/workflows/test_options.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ jobs:
111111
extra-specs: |
112112
xtensor
113113
channels: conda-forge,blah
114+
- name: check channels are correct
115+
run: |
116+
CHANNEL_OPT=$(micromamba config get channels)
117+
echo $CHANNEL_OPT
118+
if [[ "$CHANNEL_OPT" != *"conda-forge"* ]]; then
119+
exit 1;
120+
fi
121+
if [[ "$CHANNEL_OPT" != *"blah"* ]]; then
122+
exit 1;
123+
fi
124+
if [[ "${{ matrix.environment-file }}" != "false" ]]; then
125+
if [[ "$CHANNEL_OPT" != *"defaults"* ]]; then
126+
exit 1;
127+
fi
128+
fi
114129
115130
test_environment_without_name:
116131
name: "Test environment.yml without name: attribute"

dist/main/index.js

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,17 @@ function makeCondarcOpts (inputs, extraChannels) {
243243
if (inputs.channelAlias) {
244244
condarcOpts.channel_alias = inputs.channelAlias
245245
}
246-
const channels =
247-
inputs.channels && extraChannels
248-
? inputs.channels + ',' + extraChannels.join(', ')
249-
: inputs.channels || extraChannels?.join(', ')
246+
let channels = []
247+
if (inputs.channels) {
248+
channels = inputs.channels.split(',').map(s => s.trim())
249+
}
250+
if (extraChannels) {
251+
channels.push.apply(channels, extraChannels)
252+
}
250253
if (channels) {
251-
condarcOpts.channels = channels.split(',').map(s => s.trim())
254+
condarcOpts.channels = channels
252255
}
256+
253257
const moreOpts = yaml.safeLoad(inputs.condaRcOptions)
254258
if (moreOpts) {
255259
condarcOpts = { ...condarcOpts, ...moreOpts }
@@ -446,7 +450,7 @@ async function main () {
446450
}
447451

448452
// Setup .condarc
449-
const condarcOpts = makeCondarcOpts(inputs, envYaml?.extraChannels)
453+
const condarcOpts = makeCondarcOpts(inputs, envYaml?.channels)
450454
if (inputs.condaRcFile) {
451455
fs.copyFileSync(inputs.condaRcFile, PATHS.condarc)
452456
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"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",
99
"build-readme": "node generate-inputs-docs.js",
10-
"lint": "standard *.js"
10+
"lint": "standard *.js --fix"
1111
},
1212
"repository": {
1313
"type": "git",

0 commit comments

Comments
 (0)