fix(ci): skip npm publish on fork PRs in PR artifact workflow - #671
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-671Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr671.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 🏷 Picked up the PR review. Pulling the branch locally to inspect the diff against master, re-run the claimed verifications (YAML parse, JS syntax, comment-step simulation), and screen for duplicates before giving a verdict. |
[bot] 🏷 Review complete — approved, ready to merge. Duplicate screeningNo duplicates in this repo: #671 is the sole fix for #670 (properly linked via Diff cleanlinessSingle file, +10/−1, every line on-topic: Independent verification (re-ran all claimed checks)
Correctness notes
No functional issues found; nothing to patch on the branch. 中文摘要:逐行审查了 diff(单文件 +10/−1,干净),独立重跑了全部验证(YAML 解析、内嵌 JS 语法检查、fork/非-fork 两种评论模拟——非-fork 输出与旧格式字节级一致、fork 输出无幽灵 npm tag),并确认这是唯一需要该门控的 pull_request 触发工作流;无功能问题,可以合并。 |
Fixes #670
Problem
The
PR Build Artifactworkflow triggers on everypull_requestto master, including fork PRs. Its "Publish to npm with PR tag" step authenticates withsecrets.NPM_TOKEN, but GitHub does not pass repository secrets to workflows triggered by fork PRs — so on fork PRs the token is empty andnpm publishfails withENEEDAUTH, failing the job and skipping all subsequent steps (tarball, artifact upload, PR comment).Observed on #668 (run 34380059571): build succeeded, publish failed with ENEEDAUTH (
NODE_AUTH_TOKEN:empty in the publish step), tarball/upload/comment steps skipped. Also affects other fork PRs (e.g. #657, run 34376788600).Fix
if: github.event.pull_request.head.repo.full_name == github.repositoryNo credential or workflow permission changes; this is pure workflow gating.
Verification
node --check.context/githubfor both cases: non-fork output is byte-identical to the previous comment format; fork output contains only the skip notice + artifact install instructions (no phantom npm tag).