From aeb00f70d0bb38b100316a7e63b971fd73a682c8 Mon Sep 17 00:00:00 2001 From: Daniel Bast <2790401+dbast@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:55:05 +0100 Subject: [PATCH 1/2] Fix env activation on win (a v3 regression) due to hard-coded install PATH --- .github/workflows/regression-checks.yml | 25 +++++++++++++++++++++++++ dist/setup/index.js | 6 +++--- src/conda.ts | 6 +++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regression-checks.yml b/.github/workflows/regression-checks.yml index 04f4bc50..5c49db60 100644 --- a/.github/workflows/regression-checks.yml +++ b/.github/workflows/regression-checks.yml @@ -49,3 +49,28 @@ jobs: - run: | set -x python -c "import sys; assert f'{sys.version_info.major}.{sys.version_info.minor}' == '${{ matrix.python-version }}'" + + issue-324: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + activate-environment: test-env + miniforge-version: latest + auto-update-conda: true + conda-solver: libmamba + - name: windows debug + shell: cmd /C CALL {0} + run: >- + conda info && conda list && set + + - name: test for correct environment being activated + shell: cmd /C CALL {0} + run: >- + if "%CONDA_DEFAULT_ENV%" == "test-env" ( + echo "test-env activated" + ) else ( + echo "test-env not activated" + exit 1 + ) diff --git a/dist/setup/index.js b/dist/setup/index.js index 6b2f6d59..65142ce4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -47495,9 +47495,9 @@ function condaInit(inputs, options) { } else { extraShells = { - "C:/Miniconda3/etc/profile.d/conda.sh": bashExtraText, - "C:/Miniconda3/etc/fish/conf.d/conda.fish": bashExtraText, - "C:/Miniconda3/condabin/conda_hook.bat": batchExtraText, + "~/miniconda3/etc/profile.d/conda.sh": bashExtraText, + "~/miniconda3/etc/fish/conf.d/conda.fish": bashExtraText, + "~/miniconda3/condabin/conda_hook.bat": batchExtraText, }; } const allShells = Object.assign(Object.assign({}, shells), extraShells); diff --git a/src/conda.ts b/src/conda.ts index 15f3a1b4..3cf527a9 100644 --- a/src/conda.ts +++ b/src/conda.ts @@ -285,9 +285,9 @@ export async function condaInit( }; } else { extraShells = { - "C:/Miniconda3/etc/profile.d/conda.sh": bashExtraText, - "C:/Miniconda3/etc/fish/conf.d/conda.fish": bashExtraText, - "C:/Miniconda3/condabin/conda_hook.bat": batchExtraText, + "~/miniconda3/etc/profile.d/conda.sh": bashExtraText, + "~/miniconda3/etc/fish/conf.d/conda.fish": bashExtraText, + "~/miniconda3/condabin/conda_hook.bat": batchExtraText, }; } const allShells: types.IShells = { ...shells, ...extraShells }; From e7c89c5455f54897e55c4341f9644ef86232abe9 Mon Sep 17 00:00:00 2001 From: Daniel Bast <2790401+dbast@users.noreply.github.com> Date: Wed, 29 Nov 2023 17:03:30 +0100 Subject: [PATCH 2/2] Prevent fork runs --- .github/workflows/regression-checks.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/regression-checks.yml b/.github/workflows/regression-checks.yml index 5c49db60..af916f3d 100644 --- a/.github/workflows/regression-checks.yml +++ b/.github/workflows/regression-checks.yml @@ -51,7 +51,12 @@ jobs: python -c "import sys; assert f'{sys.version_info.major}.{sys.version_info.minor}' == '${{ matrix.python-version }}'" issue-324: + # prevent cronjobs from running on forks + if: + (github.event_name == 'schedule' && github.repository == + 'conda-incubator/setup-miniconda') || (github.event_name != 'schedule') runs-on: windows-latest + name: Issue 324 steps: - uses: actions/checkout@v4 - uses: ./