1
- name : PNPM Cache Example - Force 422
1
+ name : PNPM Cache Example - Try 422
2
2
3
3
on :
4
4
workflow_call :
@@ -18,23 +18,27 @@ jobs:
18
18
- name : Install PNPM
19
19
run : npm install -g pnpm
20
20
21
- - name : Set invalid cache path
22
- id : invalid-path
21
+ - name : Set store path dynamically (simulate path differences)
22
+ id : set_path
23
23
run : |
24
- # Setting a path that likely doesn't exist or isn't accessible to cause failure
25
- echo "store_path=/nonexistent/path/for/cache" >> $GITHUB_OUTPUT
26
-
27
- - name : Restore PNPM cache with invalid path
24
+ # Example: path depends on env or runner user (simulate mismatch)
25
+ if [[ "$(hostname)" == "my-azure-runner" ]]; then
26
+ echo "store_path=/home/azureuser/.local/share/pnpm/store/v10" >> $GITHUB_OUTPUT
27
+ else
28
+ echo "store_path=/home/ec2-user/_work/_tool/node/18.20.4/x64" >> $GITHUB_OUTPUT
29
+ fi
30
+
31
+ - name : Restore PNPM cache
28
32
uses : actions/cache@v4
29
33
with :
30
- path : ${{ steps.invalid-path .outputs.store_path }}
31
- key : pnpm-store-invalid-key-!@# # invalid characters to simulate error
34
+ path : ${{ steps.set_path .outputs.store_path }}
35
+ key : pnpm-store-Linux-18.20.4-v1
32
36
33
37
- name : Install dependencies
34
- run : pnpm install || echo "pnpm install failed as expected"
38
+ run : pnpm install
35
39
36
- - name : Save PNPM cache with invalid path
40
+ - name : Save PNPM cache
37
41
uses : actions/cache@v4
38
42
with :
39
- path : ${{ steps.invalid-path .outputs.store_path }}
40
- key : pnpm-store-invalid-key-!@#
43
+ path : ${{ steps.set_path .outputs.store_path }}
44
+ key : pnpm-store-Linux-18.20.4-v1
0 commit comments