Skip to content

Commit 4c76de3

Browse files
committed
🐛 fix: proj_main lockfile hash
1 parent 45b75c6 commit 4c76de3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

proj_main.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,26 @@ jobs:
5151
cache: "pnpm"
5252
cache-dependency-path: **/pnpm-lock.yaml # ← ensures cache is invalidated when lockfile changes
5353

54+
- name: Compute lockfile hash
55+
id: lockhash
56+
shell: bash
57+
run: |
58+
set -euo pipefail
59+
files=$(git ls-files '**/pnpm-lock.yaml' || true)
60+
if [ -z "$files" ]; then
61+
echo "hash=none" >> "$GITHUB_OUTPUT"
62+
else
63+
hash=$(cat $files | sha256sum | cut -d' ' -f1)
64+
echo "hash=$hash" >> "$GITHUB_OUTPUT"
65+
fi
66+
5467
- name: Cache pnpm store
5568
uses: actions/cache@v4
5669
env:
5770
cache_name: pnpm-store-cache
5871
with:
5972
path: ~/.pnpm-store
60-
key: build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.sha_short {% templatetag closevariable %}-${% templatetag openvariable %} hashFiles('**/pnpm-lock.yaml') {% templatetag closevariable %}
73+
key: build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.sha_short {% templatetag closevariable %}-${% templatetag openvariable %} steps.lockhash.outputs.hash {% templatetag closevariable %}
6174
restore-keys: |
6275
build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.sha_short {% templatetag closevariable %}
6376
build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}
@@ -69,7 +82,7 @@ jobs:
6982
cache_name: pip-cache
7083
with:
7184
path: ~/.cache/pip
72-
key: build-${% templatetag openvariable %} env.cache_name }}-${% templatetag openvariable %} steps.git.outputs.branch }}-${% templatetag openvariable %} steps.git.outputs.sha_short {% templatetag closevariable %}
85+
key: build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.sha_short {% templatetag closevariable %}
7386
restore-keys: |
7487
build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}-${% templatetag openvariable %} steps.git.outputs.branch {% templatetag closevariable %}
7588
build-${% templatetag openvariable %} env.cache_name {% templatetag closevariable %}

0 commit comments

Comments
 (0)