@@ -42,19 +42,21 @@ jobs:
42
42
with :
43
43
script : |
44
44
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) {
46
48
const response = await github.rest.pulls.get({
47
49
owner: github.context.repo.owner,
48
50
repo: github.context.repo.repo,
49
- pull_number: github.event .pull_request.number
51
+ pull_number: parsedEvent .pull_request.number
50
52
});
51
53
52
54
pr = response.data;
53
55
} else {
54
56
const ref = '${{ github.ref }}';
55
57
const branch = ref.replace('refs/heads/', '');
56
- console.log(ref);
57
- console.log(branch);
58
+ console.log('ref', ref);
59
+ console.log('branch', branch);
58
60
const response = await github.rest.pulls.list({
59
61
owner: context.repo.owner,
60
62
repo: context.repo.repo,
@@ -64,26 +66,20 @@ jobs:
64
66
65
67
if (response.data.length > 0) {
66
68
pr = response.data[0];
67
- } else {
68
- core.setOutput('run-e2e', false);
69
- console.log('No PR found matching the branch');
70
69
}
71
70
}
72
71
73
72
if (!pr) {
73
+ core.setOutput('run-e2e', false);
74
74
console.log('No PR found');
75
75
return;
76
76
}
77
77
78
78
const labels = pr.labels.map(label => label.name);
79
+ const labelFound = labels.includes('ready-for-e2e');
79
80
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);
87
83
88
84
type-check :
89
85
name : Type check
0 commit comments