7
7
- ' *'
8
8
merge_group :
9
9
pull_request :
10
- types : [assigned, opened, synchronize, reopened]
10
+ types : [labeled, synchronize, reopened, ready_for_review, opened ]
11
11
12
12
concurrency :
13
13
group : ${{ github.workflow }}-${{ github.head_ref || github.ref }}
@@ -16,6 +16,8 @@ concurrency:
16
16
env :
17
17
REGISTRY : ghcr.io
18
18
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') }}
19
21
20
22
jobs :
21
23
docker-build :
53
55
type=ref,event=branch,branch=main
54
56
type=ref,event=branch,branch=main,suffix=-${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.timestamp }}
55
57
type=pep440,pattern={{raw}}
56
- type=ref,event=pr
58
+ type=ref,event=pr,suffix=-${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.timestamp }}
57
59
58
60
- name : Set up QEMU
59
61
uses : docker/setup-qemu-action@v3
@@ -67,14 +69,14 @@ jobs:
67
69
with :
68
70
context : .
69
71
platforms : linux/amd64, linux/arm64
70
- push : ${{ github.event_name != 'pull_request' }}
72
+ push : ${{ github.event_name != 'pull_request' || env.PUSH_FROM_PR == 'true' }}
71
73
tags : ${{ steps.meta.outputs.tags }}
72
74
labels : ${{ steps.meta.outputs.labels }}
73
75
cache-from : type=gha
74
76
cache-to : type=gha,mode=max
75
77
76
78
- name : Generate artifact attestation
77
- if : github.event_name != 'pull_request'
79
+ if : github.event_name != 'pull_request' || env.PUSH_FROM_PR == 'true'
78
80
uses : actions/attest-build-provenance@v2
79
81
with :
80
82
subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
0 commit comments