@@ -41,71 +41,75 @@ jobs:
41
41
name : Check for E2E label
42
42
outputs :
43
43
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')) }}
44
- run-jobs : ${{ github.event.action != 'labeled' }}
45
44
steps :
46
45
- name : Check if PR exists with ready-for-e2e label for this SHA
47
46
id : check-if-pr-has-label
48
47
uses : actions/github-script@v7
49
48
with :
50
49
script : |
51
- console.log('github.event.action', '${{ github.event.action }}');
52
- try {
53
- const sha = '${{ needs.changes.outputs.commit-sha }}';
54
- console.log('sha', sha);
55
- const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
56
- owner: context.repo.owner,
57
- repo: context.repo.repo,
58
- commit_sha: sha
59
- });
60
-
61
- if (prs.length === 0) {
50
+ let labels = [];
51
+
52
+ if (context.payload.pull_request) {
53
+ labels = context.payload.pull_request.labels;
54
+ } else {
55
+ try {
56
+ const sha = '${{ needs.changes.outputs.commit-sha }}';
57
+ console.log('sha', sha);
58
+ const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
59
+ owner: context.repo.owner,
60
+ repo: context.repo.repo,
61
+ commit_sha: sha
62
+ });
63
+
64
+ if (prs.length === 0) {
65
+ core.setOutput('run-e2e', false);
66
+ console.log(`No pull requests found for commit SHA ${sha}`);
67
+ return;
68
+ }
69
+
70
+ const pr = prs[0];
71
+ console.log(`PR number: ${pr.number}`);
72
+ console.log(`PR title: ${pr.title}`);
73
+ console.log(`PR state: ${pr.state}`);
74
+ console.log(`PR URL: ${pr.html_url}`);
75
+
76
+ labels = pr.labels;
77
+ }
78
+ catch (e) {
62
79
core.setOutput('run-e2e', false);
63
- console.log(`No pull requests found for commit SHA ${sha}`);
64
- return;
80
+ console.log(e);
65
81
}
66
-
67
- const pr = prs[0];
68
- console.log(`PR number: ${pr.number}`);
69
- console.log(`PR title: ${pr.title}`);
70
- console.log(`PR state: ${pr.state}`);
71
- console.log(`PR URL: ${pr.html_url}`);
72
-
73
- const labels = pr.labels.map(label => label.name);
74
- const labelFound = labels.includes('ready-for-e2e');
75
- console.log('PR #', pr.number);
76
- console.log('Found the label?', labelFound);
77
- core.setOutput('run-e2e', labelFound);
78
- }
79
- catch (e) {
80
- core.setOutput('run-e2e', false);
81
- console.log(e);
82
82
}
83
83
84
+ const labelFound = labels.map(l => l.name).includes('ready-for-e2e');
85
+ console.log('Found the label?', labelFound);
86
+ core.setOutput('run-e2e', labelFound);
87
+
84
88
type-check :
85
89
name : Type check
86
90
needs : [changes, check-label]
87
- if : ${{ needs.check-label.outputs.run-jobs == 'true ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
91
+ if : ${{ github.event.action != 'labeled ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
88
92
uses : ./.github/workflows/check-types.yml
89
93
secrets : inherit
90
94
91
95
lint :
92
96
name : Linters
93
97
needs : [changes, check-label]
94
- if : ${{ needs.check-label.outputs.run-jobs == 'true ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
98
+ if : ${{ github.event.action != 'labeled ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
95
99
uses : ./.github/workflows/lint.yml
96
100
secrets : inherit
97
101
98
102
unit-test :
99
103
name : Tests
100
104
needs : [changes, check-label]
101
- if : ${{ needs.check-label.outputs.run-jobs == 'true ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
105
+ if : ${{ github.event.action != 'labeled ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
102
106
uses : ./.github/workflows/unit-tests.yml
103
107
secrets : inherit
104
108
105
109
integration-test :
106
110
name : Tests
107
111
needs : [changes, check-label]
108
- if : ${{ needs.check-label.outputs.run-jobs == 'true ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
112
+ if : ${{ github.event.action != 'labeled ' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
109
113
uses : ./.github/workflows/integration-tests.yml
110
114
secrets : inherit
111
115
@@ -166,7 +170,6 @@ jobs:
166
170
167
171
required :
168
172
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' }}
170
173
runs-on : buildjet-2vcpu-ubuntu-2204
171
174
steps :
172
175
- name : fail if conditional jobs failed
0 commit comments