Skip to content

Commit

Permalink
Edit .bashrc to be able to call SCT
Browse files Browse the repository at this point in the history
  • Loading branch information
jcohenadad authored Oct 28, 2024
1 parent 5d65f73 commit 935a9e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/run_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ jobs:
run: |
git clone --depth 1 https://github.com/spinalcordtoolbox/spinalcordtoolbox.git
yes | spinalcordtoolbox/install_sct
# Make SCT callable from within the environment
source /home/runner/.bashrc
# 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
# This workaround should be replaced by https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3198#discussion_r568225392
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
# Make sure SCT can be called from withing the environment
sct_check_dependencies
- name: Run Jupyter Notebooks
continue-on-error: true # Allow workflow to continue even if notebook execution fails
env:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${{ env.PATH }}
run: |
echo $PATH
mkdir -p executed_notebooks
Expand Down

0 comments on commit 935a9e5

Please sign in to comment.