From c4851a5c45b6dab7f2ba7f2dc3a3aa580980001a Mon Sep 17 00:00:00 2001 From: kongenpei Date: Wed, 1 Apr 2026 11:15:54 +0800 Subject: [PATCH] ci: improve pkg.pr.new install comment clarity (#168) * ci: improve pkg.pr.new install comment clarity * ci: add emojis to pkg.pr.new install comment headings * ci: avoid hard fail when PR head metadata is missing --------- Co-authored-by: kongenpei --- .github/workflows/pkg-pr-new.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index f529abc3..ee07e71f 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -41,13 +41,36 @@ jobs: if (!url) { throw new Error("No package URL found in output.json"); } + const sourceRepo = context.payload.pull_request?.head?.repo?.full_name; + const sourceBranch = context.payload.pull_request?.head?.ref; + const hasSkillSource = Boolean(sourceRepo && sourceBranch); + + const skillSection = hasSkillSource + ? [ + "", + "### 🧩 Skill update", + "", + "```bash", + `npx skills add ${sourceRepo}#${sourceBranch} -y -g`, + "```", + ] + : [ + "", + "### 🧩 Skill update", + "", + "_Unavailable for this PR because source repo/branch metadata is missing._", + ]; const body = [ - "Install this PR change globally:", + "", + "## 🚀 PR Preview Install Guide", + "", + "### 🧰 CLI update", "", "```bash", `npm i -g ${url}`, "```", + ...skillSection, ].join("\n"); const issueNumber = context.issue.number; @@ -61,7 +84,7 @@ jobs: const existing = comments.find((comment) => comment.user?.login === "github-actions[bot]" && typeof comment.body === "string" && - comment.body.startsWith("Install this PR change globally:") + comment.body.includes("") ); if (existing) {