用途:为 Astro 的 pull request 发布预览构建,让用户在合并前安装并测试该 PR 的改动。预览发布基于 pkg.pr.new。
触发方式:给 PR 添加 pr preview 标签。 gh pr edit <PR_NUMBER> --repo withastro/astro --add-label "pr preview" 这会启动名为 Publish preview release 的 GitHub Actions 任务。
监控:轮询检查直到任务完成。 gh pr checks <PR_NUMBER> --repo withastro/astro | grep -i "preview" 任务通常几分钟内完成。显示 pass 后,pkg-pr-new 机器人会在 PR 上评论,附上安装命令。
读取评论:机器人评论包含各包的安装命令,例如: npm i https://pkg.pr.new/astro@<PR_NUMBER> npm i https://pkg.pr.new/@astrojs/cloudflare@<PR_NUMBER> npm i https://pkg.pr.new/@astrojs/node@<PR_NUMBER>
分享哪个包:根据修复所在位置选择。修复在 packages/astro/ 则分享 astro@<PR_NUMBER>;在 packages/integrations/node/ 则分享 @astrojs/node@<PR_NUMBER>;在 packages/integrations/cloudflare/ 则分享 @astrojs/cloudflare@<PR_NUMBER>;涉及多个包则全部分享。
回复 issue:拿到安装命令后,在原 issue 上评论以便报告者测试: gh issue comment <ISSUE_NUMBER> --repo withastro/astro --body "A preview build is available for testing:\n\n```\nnpm i https://pkg.pr.new/astro@<PR_NUMBER>\n```\n\nPlease let us know if this resolves the issue."
限制:资料未提供该技能的具体收费、平台兼容性或更多前置要求。