Skip to content

Commit 7ff255d

Browse files
fix: New CI workflow flaws in detecting the ready-for-e2e label on PRs (#15534)
* logging the event * Added logging * Trying a different way to reference the event names * Trying to fix string issues * Clean up
1 parent 4a88051 commit 7ff255d

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

.github/workflows/pr.yml

+10-14
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@ jobs:
4242
with:
4343
script: |
4444
let pr;
45-
if (github.event && github.event.pull_request) {
45+
console.log('github.event_name', '${{ github.event_name }}');
46+
const parsedEvent = ${{ github.event }};
47+
if (parsedEvent && parsedEvent.pull_request) {
4648
const response = await github.rest.pulls.get({
4749
owner: github.context.repo.owner,
4850
repo: github.context.repo.repo,
49-
pull_number: github.event.pull_request.number
51+
pull_number: parsedEvent.pull_request.number
5052
});
5153
5254
pr = response.data;
5355
} else {
5456
const ref = '${{ github.ref }}';
5557
const branch = ref.replace('refs/heads/', '');
56-
console.log(ref);
57-
console.log(branch);
58+
console.log('ref', ref);
59+
console.log('branch', branch);
5860
const response = await github.rest.pulls.list({
5961
owner: context.repo.owner,
6062
repo: context.repo.repo,
@@ -64,26 +66,20 @@ jobs:
6466
6567
if (response.data.length > 0) {
6668
pr = response.data[0];
67-
} else {
68-
core.setOutput('run-e2e', false);
69-
console.log('No PR found matching the branch');
7069
}
7170
}
7271
7372
if (!pr) {
73+
core.setOutput('run-e2e', false);
7474
console.log('No PR found');
7575
return;
7676
}
7777
7878
const labels = pr.labels.map(label => label.name);
79+
const labelFound = labels.includes('ready-for-e2e');
7980
console.log('PR #', pr.number);
80-
if (labels.includes('ready-for-e2e')) {
81-
core.setOutput('run-e2e', true);
82-
console.log('Found the label');
83-
} else {
84-
core.setOutput('run-e2e', false);
85-
console.log('Did not find the label');
86-
}
81+
console.log('Found the label?', labelFound);
82+
core.setOutput('run-e2e', labelFound);
8783
8884
type-check:
8985
name: Type check

0 commit comments

Comments
 (0)