From 92d93d8af848de738f79cbc8186053a1b5d4fdd8 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Fri, 31 Jul 2026 23:22:32 +0100 Subject: [PATCH] Derive the release-channel repo slug from the checkout origin release_run.py hard-coded the owner/repo fallback for GITHUB_REPOSITORY, which the tenant firewall (repos_sync --check) flags as an instance fact in organ code. The slug now derives from this checkout's own origin, the same identity source the firewall's local-checkout check uses; with no origin the gh-backed callables fail and the check reports unavailable rather than guessing. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01DD69oa5NiimvmLZwLT3gWz --- heart/checks/release_run.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/heart/checks/release_run.py b/heart/checks/release_run.py index 0f62ae5f..993c310f 100644 --- a/heart/checks/release_run.py +++ b/heart/checks/release_run.py @@ -30,6 +30,7 @@ import datetime import json import os +import re import subprocess import sys import tempfile @@ -39,7 +40,27 @@ HEART_HOME = Path(__file__).resolve().parents[2] HEART_STATE_DIR = Path(os.environ.get("HEART_STATE_DIR") or Path.home() / ".pyauto-heart") -RELEASE_REPO = os.environ.get("GITHUB_REPOSITORY", "PyAutoLabs/PyAutoHeart") +def _own_repo_slug() -> str: + """owner/repo of this checkout's origin — the release channel lives here. + + Derived rather than hard-coded so the tenant firewall + (PyAutoMind/scripts/repos_sync.py) holds: organ code carries no + instance facts. Empty when there is no origin; the gh-backed callables + then fail and the check reports unavailable instead of guessing. + """ + try: + url = subprocess.run( + ["git", "-C", str(HEART_HOME), "remote", "get-url", "origin"], + capture_output=True, + text=True, + ).stdout.strip() + except OSError: + url = "" + m = re.search(r"[:/]([^/:]+/[^/:]+?)(?:\.git)?$", url) + return m.group(1) if m else "" + + +RELEASE_REPO = os.environ.get("GITHUB_REPOSITORY") or _own_repo_slug() RELEASE_WORKFLOW = "release-integrate.yml" STAGE_ARTIFACT = "release-stage-report" SIDECAR = HEART_STATE_DIR / "release_run.json"