File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 80
80
event: 'APPROVE',
81
81
})
82
82
83
+ // Wait for PR toolkit to finish (up to 3 minutes) on the pull request
84
+ let i = 0;
85
+ let prToolkitSuccessful = false;
86
+ while (i++ < 60) {
87
+ const resp = await github.rest.checks.listForRef({
88
+ owner: context.repo.owner,
89
+ repo: context.repo.repo,
90
+ ref: `pull/${pullRequestNumber}/head`,
91
+ check_name: 'apify-pr-toolkit',
92
+ });
93
+
94
+ if (resp.data.check_runs.length > 1) {
95
+ throw new Error('There are more than one PR toolkit runs, this should be impossible');
96
+ }
97
+
98
+ if (resp.data.check_runs.length === 1 && resp.data.check_runs[0].status === 'completed') {
99
+ if (resp.data.check_runs[0].conclusion === 'success') {
100
+ console.log('PR toolkit succeeded');
101
+ prToolkitSuccessful = true;
102
+ break;
103
+ } else {
104
+ throw new Error('PR toolkit failed');
105
+ }
106
+ }
107
+
108
+ await new Promise((resolve) => setTimeout(resolve, 3000));
109
+ }
110
+ if (!prToolkitSuccessful) {
111
+ throw new Error('PR toolkit check did not finish in time');
112
+ }
113
+
83
114
// Merge pull request
84
115
await github.rest.pulls.merge({
85
116
owner: context.repo.owner,
You can’t perform that action at this time.
0 commit comments