Files

18 lines
725 B
Python

"""challs.txt for the deployment repo: what infra deploys."""
from __future__ import annotations
from .overview import Overview
def render_challs(ov: Overview) -> str:
"""One clone URL per line, for everything that is included in this CTF,
Testing Ready or beyond and not blocked."""
return "".join(f"{c.repo.ssh_url}\n" for c in ov.testable)
def challs_message(old: str, new: str, path: str) -> str:
name = lambda u: u.rsplit("/", 1)[-1].removesuffix(".git")
was, now = set(old.split()), set(new.split())
parts = [f"+{name(u)}" for u in sorted(now - was)] + [f"-{name(u)}" for u in sorted(was - now)]
return f"Update {path} from challenge status" + (f": {' '.join(parts)}" if parts else "")