INNER CODE UNIT · Python
_q
hadriansecurity/OpenHack · src/openhack/run.py:18
def _q(value: str | None) -> str:
return json.dumps(value)
def init_run(
target: str,
git_url: str,
run_id: str | None = None,
branch: str | None = None,
) -> Path:
_safe(target, "target")
run_id = run_id or datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
_safe(run_id, "run_id")
path = ensure_run_dirs(target, run_id)
source = path / "sourcecode"
if any(source.iterdir()):
raise FileExistsError(f"sourcecode is not empty: {source}")
cmd = ["git", "clone", "--depth", "1"]