Skip to content

Update README to include information on activation for restricted envs#469

Open
goanpeca wants to merge 5 commits intoconda-incubator:mainfrom
goanpeca:add/readme-act-envs
Open

Update README to include information on activation for restricted envs#469
goanpeca wants to merge 5 commits intoconda-incubator:mainfrom
goanpeca:add/readme-act-envs

Conversation

@goanpeca
Copy link
Member

@goanpeca goanpeca commented Mar 17, 2026

Fixes #376

Restricted environments (no profile modifications)

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" and source conda manually on each step:

jobs:
  restricted-env:
    name: Restricted environment
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v5
      - uses: conda-incubator/setup-miniconda@v3
        with:
          activate-environment: myenv
          environment-file: environment.yml
          run-init: "false"
          remove-profiles: "false"
      - name: Run with conda
        shell: bash
        run: |
          source "$CONDA/etc/profile.d/conda.sh"
          conda activate myenv
          python my_script.py

@goanpeca goanpeca requested a review from a team as a code owner March 17, 2026 19:26
Copilot AI review requested due to automatic review settings March 17, 2026 19:26
@goanpeca goanpeca self-assigned 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 the README to document how to activate conda environments on GitHub Actions runners where shell profile files cannot be modified, addressing issue #376.

Changes:

  • Added a “Restricted environments” section describing remove-profiles: "false" usage.
  • Documented a manual activation approach using source $CONDA/etc/profile.d/conda.sh.
  • Added an approach to auto-source activation via BASH_ENV to avoid repeating source in each step.

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

@goanpeca goanpeca force-pushed the add/readme-act-envs branch from fd85231 to 59aca62 Compare March 18, 2026 16:01
@goanpeca goanpeca force-pushed the add/readme-act-envs branch from 5624d58 to 26272d3 Compare March 19, 2026 16:51
@goanpeca
Copy link
Member Author

goanpeca commented Mar 19, 2026

@conda-incubator/setup-miniconda it seems that a proper fix for this requires adding a new input param like runCondaInit, or just runInit, true by default.

The remove-profiles input parameter could be overloaded, but they really refer to different actions. This PR adds run-init and adds a check as example and a unit test.

Thoughts on the name of the parameter or any other option you might consider better?

Thanks!

@goanpeca goanpeca force-pushed the add/readme-act-envs branch from 26272d3 to bd05e31 Compare March 19, 2026 17:00
@goanpeca goanpeca force-pushed the add/readme-act-envs branch from a684b31 to 69b4db7 Compare March 19, 2026 17:14
@goanpeca goanpeca requested a review from dbast March 19, 2026 17:23
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?

3 participants