@@ -185,8 +185,12 @@ runs:
185185 # Note: try to escape | and > ...
186186 tar -czvf ${CTK_CACHE_FILENAME} ${CACHE_TMP_DIR}
187187
188- # "Move" files from temp dir to CUDA_PATH
189- CUDA_PATH="./cuda_toolkit"
188+ # Populate the final CUDA_PATH directly (never stage through ./cuda_toolkit
189+ # unconditionally — a second call with a different cuda-path would leave
190+ # symlinks from a prerelease CTK at ./cuda_toolkit/include etc., causing
191+ # "cp: cannot overwrite non-directory" failures on the next restore).
192+ CUDA_PATH="${{ inputs.cuda-path }}"
193+ rm -rf $CUDA_PATH
190194 mkdir -p $CUDA_PATH
191195 # Unfortunately we cannot use "rsync -av $CACHE_TMP_DIR/ $CUDA_PATH" because
192196 # not all runners have rsync pre-installed (or even installable, such as
@@ -209,7 +213,8 @@ runs:
209213 run : |
210214 ls -l
211215 CACHE_TMP_DIR="./cache_tmp_dir"
212- CUDA_PATH="./cuda_toolkit"
216+ CUDA_PATH="${{ inputs.cuda-path }}"
217+ rm -rf $CUDA_PATH
213218 mkdir -p $CUDA_PATH
214219 tar -xzvf $CTK_CACHE_FILENAME
215220 # Can't use rsync here, see above
@@ -220,12 +225,6 @@ runs:
220225 exit 1
221226 fi
222227
223- - name : Move CTK to the specified location
224- if : ${{ inputs.cuda-path != './cuda_toolkit' }}
225- shell : bash --noprofile --norc -xeuo pipefail {0}
226- run : |
227- mv ./cuda_toolkit ${{ inputs.cuda-path }}
228-
229228 - name : Set output environment variables
230229 shell : bash --noprofile --norc -xeuo pipefail {0}
231230 run : |
0 commit comments