Skip to content

Commit 83b1763

Browse files
Update call-reusable.yml
1 parent b5daaa4 commit 83b1763

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

.github/workflows/call-reusable.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PNPM Cache Example - Force 422
1+
name: PNPM Cache Example - Try 422
22

33
on:
44
workflow_call:
@@ -18,23 +18,27 @@ jobs:
1818
- name: Install PNPM
1919
run: npm install -g pnpm
2020

21-
- name: Set invalid cache path
22-
id: invalid-path
21+
- name: Set store path dynamically (simulate path differences)
22+
id: set_path
2323
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
2832
uses: actions/cache@v4
2933
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
3236

3337
- name: Install dependencies
34-
run: pnpm install || echo "pnpm install failed as expected"
38+
run: pnpm install
3539

36-
- name: Save PNPM cache with invalid path
40+
- name: Save PNPM cache
3741
uses: actions/cache@v4
3842
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

Comments
 (0)