-
Notifications
You must be signed in to change notification settings - Fork 3k
chore(ci): Add --provenance to npm publish and id-token permission #9532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,7 +294,7 @@ jobs: | |
| - name: 'Publish @qwen-code/sdk' | ||
| working-directory: 'packages/sdk-typescript' | ||
| run: |- | ||
| npm publish --access public --tag=${{ steps.version.outputs.NPM_TAG }} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} | ||
| npm publish --provenance --access public --tag=${{ steps.version.outputs.NPM_TAG }} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The 中文说明此处新增的 — qwen3.8-max via Qwen Code /review (v0.21.14) |
||
| env: | ||
| NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}' | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -529,7 +529,7 @@ jobs: | |
| echo "::notice::${PACKAGE_NAME}@${RELEASE_VERSION} already published; skipping" | ||
| exit 0 | ||
| fi | ||
| npm publish "${PUBLISH_ARGS[@]}" | ||
| npm publish --provenance "${PUBLISH_ARGS[@]}" | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}' | ||
| RELEASE_VERSION: '${{ needs.prepare.outputs.release_version }}' | ||
|
|
@@ -547,7 +547,7 @@ jobs: | |
| echo "::notice::${PACKAGE_NAME}@${RELEASE_VERSION} already published; skipping" | ||
| exit 0 | ||
| fi | ||
| npm publish "${PUBLISH_ARGS[@]}" | ||
| npm publish --provenance "${PUBLISH_ARGS[@]}" | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}' | ||
| RELEASE_VERSION: '${{ needs.prepare.outputs.release_version }}' | ||
|
|
@@ -565,7 +565,7 @@ jobs: | |
| echo "::notice::${PACKAGE_NAME}@${RELEASE_VERSION} already published; skipping" | ||
| exit 0 | ||
| fi | ||
| npm publish "${PUBLISH_ARGS[@]}" | ||
| npm publish --provenance "${PUBLISH_ARGS[@]}" | ||
| env: | ||
| NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}' | ||
| RELEASE_VERSION: '${{ needs.prepare.outputs.release_version }}' | ||
|
|
@@ -589,7 +589,7 @@ jobs: | |
| echo "::notice::${PACKAGE_NAME}@${RELEASE_VERSION} already published; skipping" | ||
| exit 0 | ||
| fi | ||
| npm publish "${PUBLISH_ARGS[@]}" | ||
| npm publish --provenance "${PUBLISH_ARGS[@]}" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The ~10-line "already-published guard + 中文说明这段约 10 行的「已发布检查 + — qwen3.8-max via Qwen Code /review (v0.21.14) |
||
| echo "${channel}" >> "${PUBLISH_MARKER}" | ||
| ) | ||
| echo "::endgroup::" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] Neither of the two lines this diff adds to this workflow is pinned by any test — no test references
cd-mobile-mcp.ymlat all. Two regressions would ship green: dropping--provenancehere (the mobile-mcp package would silently publish without an attestation), and dropping theid-token: 'write'permission this PR adds — which looks unused, because nothing else in this job consumes an OIDC token — so the release dies at publish time on its next real run with npm'sProvenance generation in GitHub Actions requires "write" access to the "id-token" permission. Measured: reverting this whole file to the merge base leaves all 57 script-test files green. This job was the only one that needed a permission addition in this PR, which makes it the most fragile point of the migration and the least guarded. Suggested fix: add a small workflow test (same pattern asrelease-sdk-workflow.test.js) asserting the publish job declaresid-token: 'write'and the Publish step containsnpm publish --provenance --access public.中文说明
本 diff 给该 workflow 新增的两行都没有任何测试固定——没有任何测试引用
cd-mobile-mcp.yml。两类回归都可以在 CI 全绿的情况下合入:删掉此处的--provenance(mobile-mcp 包将在没有来源证明的情况下静默发布);或删掉本 PR 新增的id-token: 'write'权限——由于该 job 中没有其他步骤使用 OIDC token,这行看起来像是无用的——于是发布在下次真实运行时因 npm 报错Provenance generation in GitHub Actions requires "write" access to the "id-token" permission而失败。实测:将该文件整体还原到合并基点后,全部 57 个脚本测试文件依然为绿。该 job 是本 PR 中唯一需要补充权限的发布点,是迁移中最脆弱、却也最缺乏防护的一环。建议修复:新增一个小型 workflow 测试(与release-sdk-workflow.test.js相同的写法),断言 publish job 声明了id-token: 'write',且 Publish 步骤包含npm publish --provenance --access public。— qwen3.8-max via Qwen Code /review (v0.21.14)