@@ -2,6 +2,7 @@ name: PR Update
2
2
3
3
on :
4
4
pull_request_target :
5
+ types : [opened, synchronize, reopened, labeled]
5
6
branches :
6
7
- main
7
8
workflow_dispatch :
@@ -27,37 +28,145 @@ jobs:
27
28
filters : |
28
29
has-files-requiring-all-checks:
29
30
- "!(**.md|.github/CODEOWNERS)"
31
+
32
+ check-label :
33
+ runs-on : buildjet-2vcpu-ubuntu-2204
34
+ name : Check for E2E label
35
+ outputs :
36
+ run-e2e : ${{ steps.check-if-pr-has-label.outputs.run-e2e == 'true' && (github.event_name != 'labeled' || (github.event_name == 'labeled' && github.event.label.name == 'ready-for-e2e')) }}
37
+ run-jobs : ${{ github.event_name != 'labeled' }}
38
+ steps :
39
+ - name : Get PR from branch name
40
+ id : check-if-pr-has-label
41
+ uses : actions/github-script@v7
42
+ with :
43
+ script : |
44
+ let pr;
45
+ console.log('github.event_name', '${{ github.event_name }}');
46
+ const parsedEvent = ${{ github.event }};
47
+ if (parsedEvent && parsedEvent.pull_request) {
48
+ const response = await github.rest.pulls.get({
49
+ owner: github.context.repo.owner,
50
+ repo: github.context.repo.repo,
51
+ pull_number: parsedEvent.pull_request.number
52
+ });
53
+
54
+ pr = response.data;
55
+ } else {
56
+ const ref = '${{ github.ref }}';
57
+ const branch = ref.replace('refs/heads/', '');
58
+ console.log('ref', ref);
59
+ console.log('branch', branch);
60
+ const response = await github.rest.pulls.list({
61
+ owner: context.repo.owner,
62
+ repo: context.repo.repo,
63
+ state: 'open',
64
+ head: `${context.repo.owner}:${branch}`
65
+ });
66
+
67
+ if (response.data.length > 0) {
68
+ pr = response.data[0];
69
+ }
70
+ }
71
+
72
+ if (!pr) {
73
+ core.setOutput('run-e2e', false);
74
+ console.log('No PR found');
75
+ return;
76
+ }
77
+
78
+ const labels = pr.labels.map(label => label.name);
79
+ const labelFound = labels.includes('ready-for-e2e');
80
+ console.log('PR #', pr.number);
81
+ console.log('Found the label?', labelFound);
82
+ core.setOutput('run-e2e', labelFound);
83
+
30
84
type-check :
31
85
name : Type check
32
- needs : [changes]
33
- if : ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
86
+ needs : [changes, check-label ]
87
+ if : ${{ needs.check-label.outputs.run-jobs == 'true' && needs. changes.outputs.has-files-requiring-all-checks == 'true' }}
34
88
uses : ./.github/workflows/check-types.yml
35
89
secrets : inherit
36
90
37
91
lint :
38
92
name : Linters
39
- needs : [changes]
40
- if : ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
93
+ needs : [changes, check-label ]
94
+ if : ${{ needs.check-label.outputs.run-jobs == 'true' && needs. changes.outputs.has-files-requiring-all-checks == 'true' }}
41
95
uses : ./.github/workflows/lint.yml
42
96
secrets : inherit
43
97
44
98
unit-test :
45
99
name : Tests
46
- needs : [changes]
47
- if : ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
100
+ needs : [changes, check-label ]
101
+ if : ${{ needs.check-label.outputs.run-jobs == 'true' && needs. changes.outputs.has-files-requiring-all-checks == 'true' }}
48
102
uses : ./.github/workflows/unit-tests.yml
49
103
secrets : inherit
50
104
51
105
integration-test :
52
106
name : Tests
53
- needs : [changes]
54
- if : ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
107
+ needs : [changes, check-label ]
108
+ if : ${{ needs.check-label.outputs.run-jobs == 'true' && needs. changes.outputs.has-files-requiring-all-checks == 'true' }}
55
109
uses : ./.github/workflows/integration-tests.yml
56
110
secrets : inherit
57
111
112
+ build-api-v1 :
113
+ name : Production builds
114
+ needs : [changes, check-label]
115
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
116
+ uses : ./.github/workflows/api-v1-production-build.yml
117
+ secrets : inherit
118
+
119
+ build-api-v2 :
120
+ name : Production builds
121
+ needs : [changes, check-label]
122
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
123
+ uses : ./.github/workflows/api-v2-production-build.yml
124
+ secrets : inherit
125
+
126
+ build :
127
+ name : Production builds
128
+ needs : [changes, check-label]
129
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
130
+ uses : ./.github/workflows/production-build-without-database.yml
131
+ secrets : inherit
132
+
133
+ e2e :
134
+ name : Tests
135
+ needs : [changes, check-label, build]
136
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
137
+ uses : ./.github/workflows/e2e.yml
138
+ secrets : inherit
139
+
140
+ e2e-app-store :
141
+ name : Tests
142
+ needs : [changes, check-label, build]
143
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
144
+ uses : ./.github/workflows/e2e-app-store.yml
145
+ secrets : inherit
146
+
147
+ e2e-embed :
148
+ name : Tests
149
+ needs : [changes, check-label, build]
150
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
151
+ uses : ./.github/workflows/e2e-embed.yml
152
+ secrets : inherit
153
+
154
+ e2e-embed-react :
155
+ name : Tests
156
+ needs : [changes, check-label, build]
157
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
158
+ uses : ./.github/workflows/e2e-embed-react.yml
159
+ secrets : inherit
160
+
161
+ analyze :
162
+ name : Analyze Build
163
+ needs : [build]
164
+ uses : ./.github/workflows/nextjs-bundle-analysis.yml
165
+ secrets : inherit
166
+
58
167
required :
59
- needs : [changes, lint, type-check, unit-test, integration-test]
60
- if : always()
168
+ needs : [changes, lint, type-check, unit-test, integration-test, check-label, build, build-api-v1, build-api-v2, e2e, e2e-embed, e2e-embed-react, e2e-app-store ]
169
+ if : ${{ needs.check-label.outputs.run-e2e == 'true' }}
61
170
runs-on : buildjet-2vcpu-ubuntu-2204
62
171
steps :
63
172
- name : fail if conditional jobs failed
0 commit comments