mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 14:02:43 +08:00
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 <kongenpei@users.noreply.github.com>
This commit is contained in:
27
.github/workflows/pkg-pr-new.yml
vendored
27
.github/workflows/pkg-pr-new.yml
vendored
@@ -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:",
|
||||
"<!-- pkg-pr-new-install-guide -->",
|
||||
"## 🚀 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("<!-- pkg-pr-new-install-guide -->")
|
||||
);
|
||||
|
||||
if (existing) {
|
||||
|
||||
Reference in New Issue
Block a user