From e7cd4555ebe1c5dc101aa2efd5b9b8a8c1fd4c18 Mon Sep 17 00:00:00 2001 From: Catalan Lover Date: Sun, 17 May 2026 13:21:14 +0200 Subject: [PATCH] Refine comment output and normalise names to prevent bugs. --- .github/scripts/pr-ghcr-image-comment.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/scripts/pr-ghcr-image-comment.js b/.github/scripts/pr-ghcr-image-comment.js index d550edea..403fb35a 100644 --- a/.github/scripts/pr-ghcr-image-comment.js +++ b/.github/scripts/pr-ghcr-image-comment.js @@ -31,7 +31,14 @@ module.exports = async ({ github, context, core }) => { const shortSha = sha.substring(0, 7); const normalizedBranch = branch.replace(/\//g, "-"); - const imageNamespace = `ghcr.io/${prOwner}/${repo}`; + const lowerOwner = prOwner.toLowerCase(); + const lowerRepo = repo.toLowerCase(); + + const imageNamespace = `ghcr.io/${lowerOwner}/${lowerRepo}`; + // The root package URL on GitHub. We can't link to the exact version ID without querying the GH API, + // so we link to the package landing page where the user can see the recent tags. + const packageUrl = `https://github.com/${prOwner}/${repo}/pkgs/container/${lowerRepo}`; + const branchTag = normalizedBranch || shortSha; const shaTag = `sha-${shortSha}`; @@ -41,9 +48,10 @@ module.exports = async ({ github, context, core }) => { `- Namespace: \`${imageNamespace}\``, `- Branch tag: \`${branchTag}\``, `- SHA tag: \`${shaTag}\``, + `- Package Page: [GHCR Link](${packageUrl})`, `- Pull: \`docker pull ${imageNamespace}:${branchTag}\``, "", - `This comment is generated from PR metadata only. It does not checkout or run PR code. It also does not reflect whether the image has actually been built yet.`, + `This comment is generated from PR metadata only. It does not checkout or run PR code and is generated in a static manner`, marker, ].join("\n");