Docker: Only cache qemu/buildx on default branch (#11241)

Docker qemu / buildx are eating up lots of cache for little benefit. Remove unless we're building from the main branch.
This commit is contained in:
Austin
2026-07-26 16:47:53 -04:00
committed by GitHub
parent 67e12dc8c0
commit 2c8a2a8cb8

View File

@@ -45,6 +45,10 @@ jobs:
outputs:
digest: ${{ steps.docker_variant.outputs.digest }}
runs-on: ${{ inputs.runs-on }}
env:
# Only cache on default branch (develop).
# 'docker/' actions don't support separate Restore/Save actions, so we have to disable caching entirely on PRs/merge_queue.
USE_CACHE: ${{ github.ref_name == github.event.repository.default_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v7
@@ -59,11 +63,12 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
cache-image: true
cache-image: ${{ env.USE_CACHE }}
- name: Docker setup
uses: docker/setup-buildx-action@v4
with:
cache-binary: ${{ env.USE_CACHE }}
# Add Google/Amazon DockerHub mirrors to buildkit config
# https://docs.docker.com/build/ci/github-actions/configure-builder/#registry-mirror
buildkitd-config-inline: |