diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh
index f4098adff847676bde42f19012633307d4e8d11c..df54161849d4f19c8b9830c6c6316dbc1c615cec 100755
--- a/ci/scripts/test.sh
+++ b/ci/scripts/test.sh
@@ -155,7 +155,7 @@ if [ "$RUN_EXAMPLES" = true ]; then
 fi
 
 if [ "$HAS_CACHE_DIR" = true ]; then
-    cp -r ${USER}/.cache/* $CACHE_DIR
+    cp -r ${HOME}/.cache/* $CACHE_DIR
     find "${CACHE_DIR}" -name '*.lock' -delete
 fi