mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
Replace the single utils/github/profile/role_summary.py script with a focused CLI package split per responsibility (model, logparse, csvio, render, github, sources). Output format is selectable via --format (table default, plus markdown, csv, json); source is auto-detected as an Ansible log, a role-runtimes CSV, or a GitHub Actions run/job URL (CSV artifacts downloaded via gh). The compose workflow now writes the CSV as a downloadable artifact and appends the per-variant markdown to the step summary, and hard-fails when the log is missing or carries no profile_roles data so a broken metrics capture can no longer pass silently. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
21 lines
577 B
Python
21 lines
577 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .csvio import read_csv
|
|
from .github import records_from_job_url
|
|
from .logparse import parse_log
|
|
|
|
if TYPE_CHECKING:
|
|
from .model import RoleRuntime
|
|
|
|
|
|
def load_records(source: str) -> list[RoleRuntime]:
|
|
"""Load runtime records from a URL, a CSV path, or an Ansible log path."""
|
|
if source.startswith(("http://", "https://")):
|
|
return records_from_job_url(source)
|
|
if Path(source).suffix == ".csv":
|
|
return read_csv(source)
|
|
return parse_log(source)
|