From 064ab798e8a84a36d227d0502313d869f462fab7 Mon Sep 17 00:00:00 2001 From: kongenpei Date: Wed, 1 Apr 2026 10:50:33 +0800 Subject: [PATCH 1/3] ci: improve pkg.pr.new install comment clarity --- .github/workflows/pkg-pr-new.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index f529abc3..0bbe7de2 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -41,13 +41,27 @@ 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; + if (!sourceRepo || !sourceBranch) { + throw new Error("No pull request source repo/branch found in event payload"); + } const body = [ - "Install this PR change globally:", + "", + "## PR Preview Install Guide", + "", + "### CLI update", "", "```bash", `npm i -g ${url}`, "```", + "", + "### Skill update", + "", + "```bash", + `npx skills add ${sourceRepo}#${sourceBranch} -y -g`, + "```", ].join("\n"); const issueNumber = context.issue.number; @@ -61,7 +75,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) { From 12eaa1a7e069da954131dd97a8d142e4940c2f5e Mon Sep 17 00:00:00 2001 From: kongenpei Date: Wed, 1 Apr 2026 10:54:02 +0800 Subject: [PATCH 2/3] ci: add emojis to pkg.pr.new install comment headings --- .github/workflows/pkg-pr-new.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 0bbe7de2..97e07f2b 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -49,15 +49,15 @@ jobs: const body = [ "", - "## PR Preview Install Guide", + "## 🚀 PR Preview Install Guide", "", - "### CLI update", + "### 🧰 CLI update", "", "```bash", `npm i -g ${url}`, "```", "", - "### Skill update", + "### 🧩 Skill update", "", "```bash", `npx skills add ${sourceRepo}#${sourceBranch} -y -g`, From fe09a9061d3ac4adb99416c755b5dfc51120d954 Mon Sep 17 00:00:00 2001 From: kongenpei Date: Wed, 1 Apr 2026 11:04:50 +0800 Subject: [PATCH 3/3] ci: avoid hard fail when PR head metadata is missing --- .github/workflows/pkg-pr-new.yml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 97e07f2b..ee07e71f 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -43,9 +43,23 @@ jobs: } const sourceRepo = context.payload.pull_request?.head?.repo?.full_name; const sourceBranch = context.payload.pull_request?.head?.ref; - if (!sourceRepo || !sourceBranch) { - throw new Error("No pull request source repo/branch found in event payload"); - } + 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 = [ "", @@ -56,12 +70,7 @@ jobs: "```bash", `npm i -g ${url}`, "```", - "", - "### 🧩 Skill update", - "", - "```bash", - `npx skills add ${sourceRepo}#${sourceBranch} -y -g`, - "```", + ...skillSection, ].join("\n"); const issueNumber = context.issue.number;