From d326eac18ce5382ebbfee233893c40aeaf2c3ded Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 5 Jan 2025 01:23:25 +0100 Subject: [PATCH] Wait for GHA eval results instead of falling back to local evaluation --- nixpkgs_review/review.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/nixpkgs_review/review.py b/nixpkgs_review/review.py index a3db522..4743a8e 100644 --- a/nixpkgs_review/review.py +++ b/nixpkgs_review/review.py @@ -4,6 +4,7 @@ import subprocess import sys import tempfile +import time from dataclasses import dataclass, field from enum import Enum from pathlib import Path @@ -296,14 +297,22 @@ def build_pr(self, pr_number: int) -> dict[System, list[Attr]]: pr = self.github_client.pull_request(pr_number) packages_per_system: dict[System, set[str]] | None = None - if self.use_github_eval and all(system in PLATFORMS for system in self.systems): - # Attempt to fetch the GitHub actions evaluation result - print("-> Attempting to fetch eval results from GitHub actions") - packages_per_system = self.github_client.get_github_action_eval_result(pr) - - if packages_per_system is not None: - print("-> Successfully fetched rebuilds: no local evaluation needed") + if self.use_github_eval: + assert all(system in PLATFORMS for system in self.systems) + print("-> Fetching eval results from GitHub actions") + packages_per_system = self.github_client.get_github_action_eval_result(pr) + if packages_per_system is None: + timeout: int = 10 + print(f"...Results are not (yet) available. Retrying in {timeout}s") + while packages_per_system is None: + print(".", end="") + time.sleep(timeout) + packages_per_system = ( + self.github_client.get_github_action_eval_result(pr) + ) + + print("-> Successfully fetched rebuilds: no local evaluation needed") else: packages_per_system = None