Skip to content

Commit 2aca099

Browse files
abbudaoLucilleH
andauthored
fix: use architecture as part of cache key (#36)
Use architecture as part of the cache key to avoid bad cache hits. The current implementation can crash pipelines using matrix strategies or when different pipelines use different architectures but leverage the Devbox action. Fixes: #35 --------- Signed-off-by: Pedro Morello Abbud <[email protected]> Co-authored-by: Lucille Hua <[email protected]>
1 parent f656242 commit 2aca099

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ runs:
5656
uses: actions/cache/restore@v4
5757
with:
5858
path: /usr/local/bin/devbox
59-
key: ${{ runner.os }}-devbox-cli-${{ env.latest_version }}
59+
key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}
6060

6161
- name: Install devbox cli
6262
if: steps.cache-devbox-cli.outputs.cache-hit != 'true'
@@ -99,7 +99,7 @@ runs:
9999
uses: actions/cache/save@v4
100100
with:
101101
path: /usr/local/bin/devbox
102-
key: ${{ runner.os }}-devbox-cli-${{ env.latest_version }}
102+
key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}
103103

104104
- name: Workaround nix store cache permission issue
105105
if: inputs.enable-cache == 'true'
@@ -145,7 +145,7 @@ runs:
145145
~/.nix-profile
146146
/nix/store
147147
/nix/var/nix
148-
key: ${{ runner.os }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
148+
key: ${{ runner.os }}-${{ runner.arch }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
149149

150150
- name: Install devbox packages
151151
shell: bash
@@ -164,7 +164,7 @@ runs:
164164
~/.nix-profile
165165
/nix/store
166166
/nix/var/nix
167-
key: ${{ runner.os }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
167+
key: ${{ runner.os }}-${{ runner.arch }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
168168

169169
- name: Restore tar command
170170
if: inputs.enable-cache == 'true'

0 commit comments

Comments
 (0)