@@ -236,7 +236,7 @@ jobs:
236236 working-directory : ./apps/codebattle
237237
238238 build_images :
239- needs : [changes]
239+ needs : [changes, backend_tests, elixir_quality, frontend_quality ]
240240 if : |
241241 github.repository == 'hexlet-codebattle/codebattle' &&
242242 (needs.changes.outputs.codebattle_image == 'true' || needs.changes.outputs.runner_image == 'true')
@@ -268,72 +268,6 @@ jobs:
268268 run : |
269269 make BUILDX_OUTPUT=--load GIT_HASH=${{ github.sha }} build-runner
270270
271- - name : Wait for required checks
272- uses : actions/github-script@v7
273- with :
274- script : |
275- const required = ["backend_tests", "elixir_quality", "frontend_quality"];
276- const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
277- const deadline = Date.now() + 45 * 60 * 1000;
278-
279- while (true) {
280- const jobs = await github.paginate(
281- github.rest.actions.listJobsForWorkflowRun,
282- {
283- owner: context.repo.owner,
284- repo: context.repo.repo,
285- run_id: context.runId,
286- per_page: 100,
287- },
288- response => response.data.jobs,
289- );
290-
291- const safeRuns = (jobs || []).filter(run => run && typeof run.name === "string");
292- const byName = new Map();
293- for (const run of safeRuns) {
294- const existing = byName.get(run.name);
295- if (!existing || (run.id ?? 0) > (existing.id ?? 0)) {
296- byName.set(run.name, run);
297- }
298- }
299- const pending = [];
300- const failed = [];
301-
302- for (const name of required) {
303- const run = byName.get(name);
304-
305- if (!run || run.status !== "completed") {
306- pending.push(name);
307- continue;
308- }
309-
310- if (run.conclusion !== "success") {
311- failed.push(`${name}:${run.conclusion}`);
312- }
313- }
314-
315- core.info(
316- `jobs_total=${(jobs || []).length}, jobs_named=${safeRuns.length}, pending=[${pending.join(", ")}], failed=[${failed.join(", ")}]`,
317- );
318-
319- if (failed.length > 0) {
320- core.setFailed(`Required checks failed: ${failed.join(", ")}`);
321- return;
322- }
323-
324- if (pending.length === 0) {
325- core.info("All required checks passed. Continue to push.");
326- return;
327- }
328-
329- if (Date.now() > deadline) {
330- core.setFailed(`Timed out waiting for required checks: ${pending.join(", ")}`);
331- return;
332- }
333-
334- await sleep(20_000);
335- }
336-
337271 - name : Login to Github Container Registry (before push)
338272 uses : docker/login-action@v3
339273 with :
0 commit comments