Files
computer-playbook/cli/meta/ci/roles/runtime/sources.py
kevinveenbirkenbachandClaude Opus 4.8 40052446dc refactor(ci): move role-runtime summary into cli.meta.ci.roles.runtime
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>
2026-06-26 03:10:07 +02:00

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)