Skip to content

Commit

Permalink
simplify get_github_action_eval_result
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Dec 18, 2024
1 parent 911beae commit 9a7e8f8
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions nixpkgs_review/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

from .utils import System

http.client.HTTPConnection.debuglevel = 1


def pr_url(pr: int) -> str:
return f"https://github.com/NixOS/nixpkgs/pull/{pr}"
Expand Down Expand Up @@ -163,20 +161,24 @@ def get_github_action_eval_result(
return None

for workflow_run in workflow_runs:
if workflow_run["name"] == "Eval":
artifacts: list[Any] = self.get(
workflow_run["artifacts_url"],
)["artifacts"]

for artifact in artifacts:
if artifact["name"] == "comparison":
changed_paths: Any = self.get_json_from_artifact(
workflow_id=artifact["id"],
json_filename="changed-paths.json",
)
if changed_paths is not None:
if "rebuildsByPlatform" in changed_paths:
return changed_paths["rebuildsByPlatform"] # type: ignore
if workflow_run["name"] != "Eval":
continue
artifacts: list[Any] = self.get(
workflow_run["artifacts_url"],
)["artifacts"]

for artifact in artifacts:
if artifact["name"] != "comparison":
continue
changed_paths: Any = self.get_json_from_artifact(
workflow_id=artifact["id"],
json_filename="changed-paths.json",
)
if changed_paths is None:
continue
if (path := changed_paths.get("rebuildsByPlatform")) is not None:
assert isinstance(path, dict)
return path
return None

def get_borg_eval_gist(self, pr: dict[str, Any]) -> dict[System, set[str]] | None:
Expand Down

0 comments on commit 9a7e8f8

Please sign in to comment.