From 23dfbf7fc77cdca3333feeb1986f2e47b50ff610 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 31 Mar 2021 20:39:58 -0400 Subject: [PATCH] update docs, add more feedback about cleanup --- README.md | 9 ++++++--- dist/setup/index.js | 14 +++++++++++--- src/setup.ts | 18 ++++++++++++------ 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 13611a62..f8f84946 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,15 @@ A `conda-build-version` or `mamba-version` may be provided to install into The base `condabin/` folder is added to `$PATH` and shell integration is initialized across all platforms. -By default, this action will then create, and activate an environment by one of: +By default, this action will then create, and _activate_, an environment by one +of: - creating a mostly-empty `test` environment, containing only the latest `python-version` and its dependencies - creating an `test` environment described in a given `environment-file`: - an `environment.yml`-like file (which can be patched with `python-version`) + - the patched environment will be cleaned up unless + `clean-patched-environment-file: false` is given - a [lockfile](#example-7-explicit-specification) This action correctly handles activation of environments and offers the @@ -118,9 +121,9 @@ activate the `base` environment. This encourages the practice of not using the `base` environment to install packages used for the workflow and leave the `base` environment untouched, with only `conda` (and/or `mamba`) in it. -## Inputs +## Inputs and outputs -For a full list of available inputs for this action see +For a full list of available _inputs_ and _outputs_ for this action see [action.yml](action.yml). ### Use a different environment name or path diff --git a/dist/setup/index.js b/dist/setup/index.js index 0664fd8f..efc29f33 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -20586,9 +20586,17 @@ function setupMiniconda(inputs) { if (inputs.activateEnvironment) { yield core.group("Ensuring environment...", () => env.ensureEnvironment(inputs, options)); } - if (inputs.cleanPatchedEnvironmentFile === "true" && - core.getState(constants.OUTPUT_ENV_FILE_WAS_PATCHED)) { - yield core.group("Cleaning up patched environment-file...", () => __awaiter(this, void 0, void 0, function* () { return fs.unlinkSync(core.getState(constants.OUTPUT_ENV_FILE_PATH)); })); + if (core.getState(constants.OUTPUT_ENV_FILE_WAS_PATCHED)) { + yield core.group("Maybe cleaning up patched environment-file...", () => __awaiter(this, void 0, void 0, function* () { + const patchedEnv = core.getState(constants.OUTPUT_ENV_FILE_PATH); + if (inputs.cleanPatchedEnvironmentFile === "true") { + fs.unlinkSync(patchedEnv); + core.info(`Cleaned ${patchedEnv}`); + } + else { + core.info(`Leaving ${patchedEnv} in place`); + } + })); } core.info("setup-miniconda ran successfully"); }); diff --git a/src/setup.ts b/src/setup.ts index a1acfa52..60412d08 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -87,12 +87,18 @@ async function setupMiniconda(inputs: types.IActionInputs): Promise { ); } - if ( - inputs.cleanPatchedEnvironmentFile === "true" && - core.getState(constants.OUTPUT_ENV_FILE_WAS_PATCHED) - ) { - await core.group("Cleaning up patched environment-file...", async () => - fs.unlinkSync(core.getState(constants.OUTPUT_ENV_FILE_PATH)) + if (core.getState(constants.OUTPUT_ENV_FILE_WAS_PATCHED)) { + await core.group( + "Maybe cleaning up patched environment-file...", + async () => { + const patchedEnv = core.getState(constants.OUTPUT_ENV_FILE_PATH); + if (inputs.cleanPatchedEnvironmentFile === "true") { + fs.unlinkSync(patchedEnv); + core.info(`Cleaned ${patchedEnv}`); + } else { + core.info(`Leaving ${patchedEnv} in place`); + } + } ); }