Skip to content

Commit

Permalink
use "channels" and not extraChannels (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv authored Jul 12, 2022
1 parent e198969 commit 87a13a6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/test_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 10 additions & 6 deletions dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 87a13a6

Please sign in to comment.