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 17, 2024
1 parent f7f5c89 commit c5f7ac8
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions nixpkgs_review/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,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 c5f7ac8

Please sign in to comment.