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