Skip to content

Commit f13df11

Browse files
committed
Add PREPARE_CONDA_ENVIRONMENT to skip Conda environment setup
1 parent 7f5b281 commit f13df11

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/public-analyze-code-graph.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797

9898
# "Setup Python" can be skipped if jupyter notebook analysis-results aren't needed
9999
- name: (Python Setup) Use version ${{ matrix.python }} with Conda package manager Miniforge
100+
id: prepare-conda-environment
100101
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3
101102
with:
102103
python-version: ${{ matrix.python }}
@@ -160,6 +161,7 @@ jobs:
160161
NEO4J_INITIAL_PASSWORD: ${{ steps.generate-neo4j-initial-password.outputs.neo4j-initial-password }}
161162
ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION: "true"
162163
IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT: "" # Options: "none", "aggregated", "full". default = "plugin" or ""
164+
PREPARE_CONDA_ENVIRONMENT: "false" # Had already been done in step with id "prepare-conda-environment".
163165
run: |
164166
TYPESCRIPT_SCAN_HEAP_MEMORY=${{ inputs.typescript-scan-heap-memory }} ./../../scripts/analysis/analyze.sh ${{ inputs.analysis-arguments }}
165167

scripts/activateCondaEnvironment.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ echo "activateCondaEnvironment: CONDA_PREFIX=${CONDA_PREFIX}"
3737
echo "activateCondaEnvironment: Current conda environment=${CONDA_DEFAULT_ENV}"
3838
echo "activateCondaEnvironment: Target conda environment=${CODEGRAPH_CONDA_ENVIRONMENT}"
3939

40-
# TODO Find out, if conda updates (when needed) should also be done here instead of just returning 0.
41-
# if [ "${CONDA_DEFAULT_ENV}" = "${CODEGRAPH_CONDA_ENVIRONMENT}" ] ; then
42-
# echo "activateCondaEnvironment: Skipping activation. Target conda environment ${CODEGRAPH_CONDA_ENVIRONMENT} is already activated."
43-
# # "return" needs to be used here instead of "exit".
44-
# # This script is included in another script by using "source".
45-
# # "exit" would end the main script, "return" just ends this sub script.
46-
# return 0
47-
# fi
40+
PREPARE_CONDA_ENVIRONMENT=${PREPARE_CONDA_ENVIRONMENT:-"true"} # Wether to prepare then Conda environment if needed (default, "true") or use an already prepared Conda environment ("false")
41+
42+
if [ "${CONDA_DEFAULT_ENV}" = "${CODEGRAPH_CONDA_ENVIRONMENT}" ] && [ "${PREPARE_CONDA_ENVIRONMENT}" = "false" ]; then
43+
echo "activateCondaEnvironment: Skipping activation. Target conda environment ${CODEGRAPH_CONDA_ENVIRONMENT} is already activated."
44+
# "return" needs to be used here instead of "exit".
45+
# This script is included in another script by using "source".
46+
# "exit" would end the main script, "return" just ends this sub script.
47+
return 0
48+
fi
4849

4950
# Include operation system function to for example detect Windows.
5051
source "${SCRIPTS_DIR}/operatingSystemFunctions.sh"

0 commit comments

Comments
 (0)