You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PR Build Artifact workflow (.github/workflows/pr-artifact.yml) triggers on every pull_request to master, including PRs from forks. Its "Publish to npm with PR tag" step authenticates with NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}. GitHub does not pass repository secrets to workflows triggered by fork PRs, so on fork PRs the token is empty and npm publish fails with ENEEDAUTH.
The build-artifact job builds successfully, then fails at "Publish to npm with PR tag" with ENEEDAUTH (npm requires login for npm publish).
Impact
The PR shows a failed CI job even though the source is fine, muddying the checks signal on fork PRs.
All steps after the publish step are skipped: tarball creation, artifact upload, and the PR comment with install instructions — fork PR authors lose the entire artifact feature.
Suggested fix
Gate the publish step to non-fork PRs:
- name: Publish to npm with PR tagif: github.event.pull_request.head.repo.full_name == github.repository
and make the "Comment on PR" step drop the "Option A — Install from npm PR tag" section for fork PRs so the comment does not advertise a tag that was never published. The tarball, artifact upload, and comment steps should still run for fork PRs.
Notes
No credential or workflow permission change is needed; this is a workflow-gating issue.
来源: #668 (#668) 分析 preflight 修复 PR 时发现
Problem
The
PR Build Artifactworkflow (.github/workflows/pr-artifact.yml) triggers on everypull_requestto master, including PRs from forks. Its "Publish to npm with PR tag" step authenticates withNODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}. GitHub does not pass repository secrets to workflows triggered by fork PRs, so on fork PRs the token is empty andnpm publishfails withENEEDAUTH.Repro
build-artifactjob builds successfully, then fails at "Publish to npm with PR tag" withENEEDAUTH(npm requires login fornpm publish).Impact
Suggested fix
Gate the publish step to non-fork PRs:
and make the "Comment on PR" step drop the "Option A — Install from npm PR tag" section for fork PRs so the comment does not advertise a tag that was never published. The tarball, artifact upload, and comment steps should still run for fork PRs.
Notes