Repository navigation
Split shell init and activation of test environment to remove spurious warning - #475
Merged
Merged
Conversation
goanpeca
force-pushed
the
fix/incorrect-warning
branch
from
March 24, 2026 00:08
3fe43a0 to
a4c4ae2
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #474 by changing when conda activation commands are appended to shell profile/hook files, aiming to avoid Windows warnings caused by attempting to activate an environment before it exists.
Changes:
- Split conda initialization into (1) shell integration/init and (2) profile/hook activation appends, and call the activation step after environment creation.
- Add
condaInitActivation()and update setup flow to invoke it later. - Minor repo hygiene updates (RELEASE formatting, ignore
coverage/in ESLint).
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/setup.ts |
Moves activation-profile writing to after ensureEnvironment() via new condaInitActivation() call. |
src/conda.ts |
Splits activation append logic out of condaInit() into new condaInitActivation() function. |
RELEASE.md |
Removes an extraneous whitespace-only line in release instructions. |
.eslintignore |
Adds coverage/ to ignored paths. |
Comments suppressed due to low confidence (2)
src/conda.ts:458
- New behavior is introduced by
condaInitActivation(and the setup flow change that calls it after env creation), but there are existing Vitest unit tests forsrc/conda.ts(e.g.,applyCondaConfigurationinsrc/__tests__/conda.test.ts). Please add tests covering the activation-profile writing logic, especially theactivate-environment: ""case (should not writeconda activate "") and the Windows hook-file behavior that motivated #474, to prevent regressions.
/**
* Append activation commands to all shell profile files so that
* subsequent workflow steps start with the correct environment active.
*
* This must be called AFTER the target environment has been created,
* otherwise `.bat` wrappers (which source `conda_hook.bat`) would try
* to activate a non-existent environment during setup and emit false
* warnings (see #474).
*
* @param inputs - The parsed action inputs.
* @param options - The current dynamic options.
*/
export async function condaInitActivation(
inputs: types.IActionInputs,
options: types.IDynamicOptions,
): Promise<void> {
const isValidActivate = !(await isDefaultEnvironment(
inputs.activateEnvironment,
inputs,
options,
));
const autoActivateDefault: boolean =
options.condaConfig.auto_activate === "true";
const installationDirectory = condaBasePath(inputs, options);
// PowerShell profiles
// NOTE: Using array.join() to prevent auto-formatters from adding indentation
const powerLines: string[] = [
"",
src/conda.ts:465
isValidActivatebecomestruewheninputs.activateEnvironmentis an empty string becauseisDefaultEnvironment("")returnsfalse; this leads to appending commands likeconda activate ""/@CALL "%CONDA_BAT%" activate ""into profile/hook files. Sinceactivate-environment: ""is a supported way to request no activation, add an explicit non-empty check (or early-return) so empty input never produces activation commands.
const isValidActivate = !(await isDefaultEnvironment(
inputs.activateEnvironment,
inputs,
options,
));
const autoActivateDefault: boolean =
options.condaConfig.auto_activate === "true";
const installationDirectory = condaBasePath(inputs, options);
// PowerShell profiles
// NOTE: Using array.join() to prevent auto-formatters from adding indentation
const powerLines: string[] = [
"",
"# ----------------------------------------------------------------------------",
];
if (isValidActivate) {
powerLines.push(
"# Conda Setup Action: Custom activation",
`conda activate "${inputs.activateEnvironment}"`,
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
goanpeca
force-pushed
the
fix/incorrect-warning
branch
2 times, most recently
from
March 24, 2026 00:34
7c5eabb to
ee7e96a
Compare
jezdez
approved these changes
Apr 1, 2026
goanpeca
force-pushed
the
fix/incorrect-warning
branch
from
April 2, 2026 02:33
ee7e96a to
56c41de
Compare
goanpeca
force-pushed
the
fix/incorrect-warning
branch
from
April 2, 2026 02:49
56c41de to
9c73b9a
Compare
jezdez
added a commit
to conda/conda
that referenced
this pull request
Apr 16, 2026
Follow-up to #15741. The original experimental branch in conda-incubator/setup-miniconda#453 has been closed and split into several non-breaking PRs that have now been merged to conda-incubator/setup-miniconda@main. This pins the action to the current main tip (a89f5d4) to measure the combined CI impact, including: - conda-incubator/setup-miniconda#465 fix double channel config apply - conda-incubator/setup-miniconda#467 bulk-move extracted pkgs on cleanup - conda-incubator/setup-miniconda#475 split shell init and activation - conda-incubator/setup-miniconda#482 channel parsing / URL validation - conda-incubator/setup-miniconda#486 remove HTML index scraping - conda-incubator/setup-miniconda#487 parallelize Windows takeown calls
3 tasks done
kenodegard
pushed a commit
to conda/conda
that referenced
this pull request
Apr 23, 2026
conda-incubator/setup-miniconda@v4.0.0 ships a number of performance improvements: - conda-incubator/setup-miniconda#465 fix double channel config apply - conda-incubator/setup-miniconda#467 bulk-move extracted pkgs on cleanup - conda-incubator/setup-miniconda#475 split shell init and activation - conda-incubator/setup-miniconda#482 channel parsing / URL validation - conda-incubator/setup-miniconda#486 remove HTML index scraping - conda-incubator/setup-miniconda#487 parallelize Windows takeown calls - conda-incubator/setup-miniconda#488 replace isDefaultEnvironment subprocess with local YAML reads - conda-incubator/setup-miniconda#489 replace conda config subprocesses with direct .condarc YAML writes v4.0.0 also upgrades the action runtime to Node.js 24.x and switches the build to ESM, which is the breaking change motivating the major bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #474