High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix: don't write cache on fork PRs (#16189)
bo0tzz5f257b9a84f7
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex f2a7afbac2..5429d8671d 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -145,7 +145,6 @@ jobs:- name: Login to GitHub Container Registryuses: docker/login-action@v3- # Skip when PR from a forkif: ${{ !github.event.pull_request.head.repo.fork }}with:registry: ghcr.io@@ -160,6 +159,16 @@ jobs:echo "CACHE_KEY_SUFFIX=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9]/-/g')" >> $GITHUB_ENVfi+ - name: Generate cache target+ id: cache-target+ run: |+ if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then+ # Essentially just ignore the cache output (forks can't write to registry cache)+ echo "cache-to=type=local,dest=/tmp/discard,ignore-error=true" >> $GITHUB_OUTPUT+ else+ echo "cache-to=type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ matrix.device }}-${{ env.CACHE_KEY_SUFFIX }},mode=max,compression=zstd" >> $GITHUB_OUTPUT+ fi+- name: Build and push imageid: builduses: docker/[email protected]@@ -168,7 +177,7 @@ jobs:file: ${{ env.file }}platforms: ${{ matrix.platforms }}labels: ${{ steps.metadata.outputs.labels }}- cache-to: type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ matrix.device }}-${{ env.CACHE_KEY_SUFFIX }},mode=max,compression=zstd+ cache-to: ${{ steps.cache-target.outputs.cache-to }}cache-from: |type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ matrix.device }}-${{ env.CACHE_KEY_SUFFIX }}type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ matrix.device }}-main@@ -297,7 +306,6 @@ jobs:- name: Login to GitHub Container Registryuses: docker/login-action@v3- # Skip when PR from a forkif: ${{ !github.event.pull_request.head.repo.fork }}with:registry: ghcr.io@@ -312,6 +320,16 @@ jobs:echo "CACHE_KEY_SUFFIX=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9]/-/g')" >> $GITHUB_ENVfi+ - name: Generate cache target+ id: cache-target+ run: |+ if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then+ # Essentially just ignore the cache output (forks can't write to registry cache)+ echo "cache-to=type=local,dest=/tmp/discard,ignore-error=true" >> $GITHUB_OUTPUT+ else+ echo "cache-to=type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ matrix.device }}-${{ env.CACHE_KEY_SUFFIX }},mode=max,compression=zstd" >> $GITHUB_OUTPUT+ fi+- name: Build and push imageid: builduses: docker/[email protected]@@ -320,7 +338,7 @@ jobs:file: ${{ env.file }}platforms: ${{ matrix.platform }}labels: ${{ steps.metadata.outputs.labels }}- cache-to: type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ env.CACHE_KEY_SUFFIX }},mode=max,compression=zstd+ cache-to: ${{ steps.cache-target.outputs.cache-to }}cache-from: |type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-${{ env.CACHE_KEY_SUFFIX }}type=registry,ref=${{ env.GHCR_REPO }}-build-cache:${{ env.PLATFORM_PAIR }}-main