diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 09de258..7bc1acb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: push: branches: [ "main" ] + pull_request: + branches: [ "main" ] env: REGISTRY: ghcr.io @@ -53,7 +55,10 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: | type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache - type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.event_name }} + type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.TARGET_BRANCH }} + type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.ref_name }} cache-to: | type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max - type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.event_name }},mode=max + type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.ref_name }},mode=max + env: + TARGET_BRANCH: ${{ github.base_ref || github.ref_name }}