Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Hash cache keys before actions/cache, not in its post step (#5365)

Nick Gomezb425db472890
diff --git a/.github/workflows/desktop-build-win-linux.yml b/.github/workflows/desktop-build-win-linux.yml
index 1382e459c..41b7b9676 100644
--- a/.github/workflows/desktop-build-win-linux.yml
+++ b/.github/workflows/desktop-build-win-linux.yml
@@ -84,10 +84,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -200,10 +204,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -456,6 +464,10 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
# `runner.arch` is part of the key: both Linux cells report
# `runner.os == 'Linux'`, and a store populated on x64 carries none of the
# arm64 prebuilds (and vice versa), so a shared key would thrash the cache
@@ -463,7 +475,7 @@ jobs:
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-
diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml
index b431b9939..bcc277717 100644
--- a/.github/workflows/desktop-build.yml
+++ b/.github/workflows/desktop-build.yml
@@ -101,10 +101,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index 1ceab368e..b4214d545 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -290,10 +290,14 @@ jobs:
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -556,10 +560,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -1057,10 +1065,14 @@ jobs:
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -1399,6 +1411,10 @@ jobs:
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
# `runner.arch` is part of the key: both Linux cells report
# `runner.os == 'Linux'`, and a store populated on x64 carries none of the
# arm64 prebuilds (and vice versa), so a shared key would thrash the cache
@@ -1406,7 +1422,7 @@ jobs:
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-ok-pnpm-store-
diff --git a/.github/workflows/native-config-prebuild.yml b/.github/workflows/native-config-prebuild.yml
index 9c94ba631..7eaf61a33 100644
--- a/.github/workflows/native-config-prebuild.yml
+++ b/.github/workflows/native-config-prebuild.yml
@@ -90,10 +90,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-
@@ -108,6 +112,10 @@ jobs:
toolchain: stable
targets: ${{ matrix.settings.target }}
+ - name: Hash the native-config Cargo files for the cargo cache key
+ id: cargo-lock
+ shell: bash
+ run: echo "hash=${{ hashFiles('packages/native-config/Cargo.lock', 'packages/native-config/Cargo.toml') }}" >> "$GITHUB_OUTPUT"
- name: Cache cargo + target
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
@@ -120,7 +128,7 @@ jobs:
# served a stale registry/target tree from an older resolution. The
# restore-keys prefix still allows a partial warm-start (registry +
# unchanged crates) on a manifest change.
- key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}-${{ hashFiles('packages/native-config/Cargo.lock', 'packages/native-config/Cargo.toml') }}
+ key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}-${{ steps.cargo-lock.outputs.hash }}
restore-keys: |
${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}-
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e9250248a..249e1274c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -165,10 +165,14 @@ jobs:
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
+ - name: Hash the lockfile for the pnpm store key
+ id: lockfile
+ shell: bash
+ run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-ok-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}
restore-keys: |
${{ runner.os }}-ok-pnpm-store-