Skip to content

Add restricted envs info#468

Closed
goanpeca wants to merge 3 commits intoconda-incubator:mainfrom
goanpeca:add-restricted-envs-info
Closed

Add restricted envs info#468
goanpeca wants to merge 3 commits intoconda-incubator:mainfrom
goanpeca:add-restricted-envs-info

Conversation

@goanpeca
Copy link
Member

Fixes #376

@goanpeca goanpeca self-assigned this Mar 17, 2026
@goanpeca goanpeca requested a review from a team as a code owner March 17, 2026 19:24
Copilot AI review requested due to automatic review settings March 17, 2026 19:24
@goanpeca goanpeca closed this Mar 17, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates documentation and workflow examples for running setup-miniconda in restricted environments, and adjusts the post-step package-cache trimming behavior.

Changes:

  • Add README guidance for environments where modifying shell profiles is restricted.
  • Change delete post action to stash extracted conda packages (rename to sibling stash dir) and clean prior stashes to avoid slow recursive deletes on Windows.
  • Bump cache reset numbers and update an example workflow to use the local action (./).

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/delete.ts Switches from recursive deletion to stashing extracted package dirs + cleanup of prior stashes.
dist/delete/index.js Rebuilt bundled output for the updated delete post action.
README.md Adds a “Restricted environments” section with suggested activation patterns.
.github/workflows/caching-example.yml Bumps CACHE_NUMBER to reset caches for the example.
.github/workflows/caching-envs-example.yml Updates example to use the local action and bumps cache reset number.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const pkgsDirs = utils.parsePkgsDirs(inputs.condaConfig.pkgs_dirs);
if (!pkgsDirs.length) return;
core.startGroup(
"Removing uncompressed packages to trim down packages directory...",
// Clean up stash directories left by previous runs (self-hosted runners)
const parentDir = path.dirname(pkgsDir);
const baseName = path.basename(pkgsDir);
for (const sibling of fs.readdirSync(parentDir)) {
Comment on lines 12 to +19
/**
* Clean up the conda cache directory
* Clean up extracted packages from the conda packages directory, keeping only
* the compressed archive cache and loose archive files.
*
* Instead of recursively deleting each extracted folder (extremely slow on
* Windows due to filesystem overhead), we rename them to a sibling directory
* on the same filesystem. On self-hosted (persistent) runners, stash
* directories from previous runs are cleaned up before new ones are created.
Comment on lines +856 to +861
If your environment does not allow modifications to `~/.profile` or `~/.bashrc`
(e.g. corporate self-hosted runners with restricted home directories), set
`remove-profiles: "false"` to prevent the action from deleting existing profile
files. Note that `conda init` will still append conda initialization to your
shell profiles — if even that is not allowed, you can source conda's shell
integration manually in each step instead of relying on `shell: bash -el {0}`:
Comment on lines +875 to +881
- name: Append activation to conda's init script
shell: bash
run: echo "conda activate myenv" >> $CONDA/etc/profile.d/conda.sh
- name: Run with conda
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
Comment on lines +905 to +906
echo "source $CONDA/etc/profile.d/conda.sh" > $BASH_ENV
echo "conda activate myenv" >> $BASH_ENV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a way to do conda init and activate environment without changing $HOME/.profile or $HOME/.bashrc?

2 participants