77 - ' *'
88 merge_group :
99 pull_request :
10- types : [assigned, opened, synchronize, reopened]
10+ types : [labeled, synchronize, reopened, ready_for_review, opened ]
1111
1212concurrency :
1313 group : ${{ github.workflow }}-${{ github.head_ref || github.ref }}
@@ -16,6 +16,8 @@ concurrency:
1616env :
1717 REGISTRY : ghcr.io
1818 IMAGE_NAME : ${{ github.repository }}
19+ # Set to 'true' to allow pushing container from pull requests with the label 'push-container'
20+ PUSH_FROM_PR : ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'push-container') }}
1921
2022jobs :
2123 docker-build :
5355 type=ref,event=branch,branch=main
5456 type=ref,event=branch,branch=main,suffix=-${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.timestamp }}
5557 type=pep440,pattern={{raw}}
56- type=ref,event=pr
58+ type=ref,event=pr,suffix=-${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.timestamp }}
5759
5860 - name : Set up QEMU
5961 uses : docker/setup-qemu-action@v3
@@ -67,14 +69,14 @@ jobs:
6769 with :
6870 context : .
6971 platforms : linux/amd64, linux/arm64
70- push : ${{ github.event_name != 'pull_request' }}
72+ push : ${{ github.event_name != 'pull_request' || env.PUSH_FROM_PR == 'true' }}
7173 tags : ${{ steps.meta.outputs.tags }}
7274 labels : ${{ steps.meta.outputs.labels }}
7375 cache-from : type=gha
7476 cache-to : type=gha,mode=max
7577
7678 - name : Generate artifact attestation
77- if : github.event_name != 'pull_request'
79+ if : github.event_name != 'pull_request' || env.PUSH_FROM_PR == 'true'
7880 uses : actions/attest-build-provenance@v2
7981 with :
8082 subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
0 commit comments