Skip to content

Commit

Permalink
update docs, add more feedback about cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl committed Apr 1, 2021
1 parent 04d1f60 commit 23dfbf7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand Down
18 changes: 12 additions & 6 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ async function setupMiniconda(inputs: types.IActionInputs): Promise<void> {
);
}

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`);
}
}
);
}

Expand Down

0 comments on commit 23dfbf7

Please sign in to comment.