Skip to content

Commit a02debe

Browse files
committed
Add the workflow run ID to the cache key
N.B. run IDs don't change on re-runs of a given workflow run Otherwise dispatch runs will use caches from the previous week if there haven't been any changes to the underlying repo. Luckily Docker seems to treat these cached layers as stale: the only real effect is that the child image builds rebuild the base and child stages so they take longer to build and they technically don't share the same base.
1 parent 841affc commit a02debe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/build-container.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: actions/cache@v2
3636
with:
3737
path: /tmp/.buildx-cache
38-
key: base-${{ matrix.repo }}-buildx-${{ github.sha }}
38+
key: base-${{ matrix.repo }}-buildx-${{ github.sha }}-${{ github.run_id }}
3939
# allow cache hits from previous runs of the current branch,
4040
# parent branch, then upstream branches, in that order
4141
restore-keys: |
@@ -70,7 +70,7 @@ jobs:
7070
uses: actions/cache@v2
7171
with:
7272
path: /tmp/.buildx-cache
73-
key: base-${{ matrix.repo }}-buildx-${{ github.sha }}
73+
key: base-${{ matrix.repo }}-buildx-${{ github.sha }}-${{ github.run_id }}
7474

7575
- name: Generate tag list
7676
id: generate-tag-list

0 commit comments

Comments
 (0)