From 21a5693e300204ad6e07de227694f0e8e2db2ed8 Mon Sep 17 00:00:00 2001 From: "Martin R. Smith" Date: Mon, 26 Apr 2021 19:17:16 +0100 Subject: [PATCH] Add flexible R env example Use variables to specify location --- examples.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/examples.md b/examples.md index f3d6788..6296b0b 100644 --- a/examples.md +++ b/examples.md @@ -412,7 +412,20 @@ Locations: - macOS: `~/Library/Application Support/renv` - Windows: `%LOCALAPPDATA%/renv` -### Simple example + +### Using variables to specify location + +(Appropriate for single or multiple operating systems.) + +```yaml + - uses: actions/cache@v2 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- +``` + +### Simple example with hard-coded path ```yaml - uses: actions/cache@v2 with: @@ -424,7 +437,7 @@ Locations: Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu. -### Multiple OS's in a workflow +### Multiple OSs in a workflow ```yaml - uses: actions/cache@v2