From 07194019180acf3926639b918e1ff46f7649866e Mon Sep 17 00:00:00 2001 From: Joshua Newton Date: Thu, 18 Jul 2024 11:27:57 -0400 Subject: [PATCH] `ci.yml`: Make sure `PATH` persists between steps Source of fix: https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/a902e199c23d4e95d5a050dcd5ad4ebccdb0e279/.github/workflows/create-release.yml#L98-L103 --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2b8fa7..646c880 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,11 @@ jobs: git clone https://github.com/spinalcordtoolbox/spinalcordtoolbox.git cd spinalcordtoolbox ./.ci.sh -i - export PATH="$PWD/spinalcordtoolbox/bin:$PATH" + # NB: install_sct edits ~/.bashrc, but those environment changes don't get passed to subsequent steps in GH Actions. + # So, we filter through the .bashrc and pass the values to $GITHUB_ENV and $GITHUB_PATH. + # Relevant documentation: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files + cat ~/.bashrc | grep "export SCT_DIR" | cut -d " " -f 2 >> $GITHUB_ENV + cat ~/.bashrc | grep "export PATH" | grep -o "/.*" | cut -d ':' -f 1 >> $GITHUB_PATH - name: Run tests with pytest run: |