From 50a2fdee6fa08b2f61cca3b302ffea8e870b2627 Mon Sep 17 00:00:00 2001
From: Josh Gross <joshmgross@github.com>
Date: Wed, 13 Nov 2019 10:18:47 -0500
Subject: [PATCH] Update yarn cache example (#70)

* Update yarn cache example

* Update examples.md

Co-Authored-By: Eric Taylor <erictaylor89@gmail.com>
---
 examples.md | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/examples.md b/examples.md
index 2d5a8a7..bf3633b 100644
--- a/examples.md
+++ b/examples.md
@@ -112,12 +112,17 @@ For npm, cache files are stored in `~/.npm` on Posix, or `%AppData%/npm-cache` o
 ```
 
 ## Node - Yarn
+The yarn cache directory will depend on your operating system and version of `yarn`. See https://yarnpkg.com/lang/en/docs/cli/cache/ for more info.
 
 ```yaml
+- name: Get yarn cache
+  id: yarn-cache
+  run: echo "::set-output name=dir::$(yarn cache dir)"
+
 - uses: actions/cache@v1
   with:
-    path: ~/.cache/yarn
-    key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
+    path: ${{ steps.yarn-cache.outputs.dir }}
+    key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
     restore-keys: |
       ${{ runner.os }}-yarn-
 ```