From b1f2ccd471a64c2fdce4c70bfe2a2012161e328e Mon Sep 17 00:00:00 2001 From: Environment Test Date: Thu, 9 Apr 2026 11:27:18 +0200 Subject: [PATCH] fix(mirror): include link to ghcr.md in GHCR_PAT warning annotation Co-Authored-By: Claude Sonnet 4.6 --- cli/mirror/publish/__main__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cli/mirror/publish/__main__.py b/cli/mirror/publish/__main__.py index 1d4d822027..617790ebbd 100644 --- a/cli/mirror/publish/__main__.py +++ b/cli/mirror/publish/__main__.py @@ -167,7 +167,14 @@ def main() -> int: flush=True, ) - _GHCR_DOC = "docs/contributing/flow/security/ghcr.md" + _GHCR_DOC_PATH = "docs/contributing/flow/security/ghcr.md" + _server = os.environ.get("GITHUB_SERVER_URL", "https://github.com").rstrip("/") + _repo = os.environ.get("GITHUB_REPOSITORY", "") + _GHCR_DOC_URL = ( + f"{_server}/{_repo}/blob/master/{_GHCR_DOC_PATH}" + if _repo + else _GHCR_DOC_PATH + ) try: pkg_iter = list(_list_packages(namespace, token, account_type)) except _InsufficientTokenError as e: @@ -175,7 +182,7 @@ def main() -> int: f"Mirror visibility update skipped — {e}. " "The GITHUB_TOKEN is an installation token and cannot list packages for personal accounts. " "Set the GHCR_PAT secret to a classic PAT with read:packages and write:packages scopes. " - f"See {_GHCR_DOC} for setup instructions.", + f"See {_GHCR_DOC_URL} for setup instructions.", title="GHCR visibility update skipped — GHCR_PAT required", ) return 0