std-traits 0.5.0

Traits for types in the standard library.
Documentation
#!/usr/bin/env -S uv run --script
#
# /// script
# dependencies = ["pyyaml"]
# ///

import yaml
from subprocess import check_output
from pathlib import Path
import json

def get_tags(repo: str) -> list[str]:
    output = check_output(["gh", "api", f"repos/{repo}/tags"])
    data = json.loads(output)
    return [d["name"] for d in data]


for path in Path(".github/workflows").iterdir():
    print(f"== {path} ==")
    with path.open("rb") as f:
        data = yaml.safe_load(f)

    versions = {}

    for job_name, job in data.get("jobs", {}).items():
        for step in job.get("steps", []):
            if action_s := step.get("uses"):
                repo, name = action_s.split("@")
                versions.setdefault(repo, set()).add(name)

    for repo, local_versions in versions.items():
        print(repo)
        print("  Used versions:", local_versions)
        print("  Repo tags:", get_tags(repo))
        print()