From 58d0f71835551ec474dff36560b2b90de3cb453b Mon Sep 17 00:00:00 2001 From: Manuel Roth Date: Tue, 19 Oct 2021 17:49:15 +0200 Subject: [PATCH] (R env) Set renv package cache location using RENV_PATHS_ROOT environment variable --- examples.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples.md b/examples.md index 06a96ec..14a677a 100644 --- a/examples.md +++ b/examples.md @@ -450,9 +450,13 @@ jobs: ## R - renv -For renv, the cache directory will vary by OS. The `renv::paths$cache()` function is used to get the cache location based on the OS and R version. Look at https://rstudio.github.io/renv/articles/renv.html#cache for more details. +For renv, the cache directory will vary by OS. The `RENV_PATHS_ROOT` environment variable is used to set the cache location. Have a look at https://rstudio.github.io/renv/reference/paths.html#details for more details. ```yaml +- name: Set RENV_PATHS_ROOT + shell: bash + run: | + echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV - name: Install and activate renv run: | install.packages("renv") @@ -472,8 +476,8 @@ For renv, the cache directory will vary by OS. The `renv::paths$cache()` functio - name: Restore Renv package cache uses: actions/cache@v2 with: - path: ${{ steps.get-renv-cache-path.outputs.renv-cache-path }} - key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-${{ hashFiles('renv.lock') }} + path: ${{ env.RENV_PATHS_ROOT }} + key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}- ```