Skip to content

chore(release): publish to npm with trusted publishing - #283

Open
cs-raj wants to merge 2 commits into
developmentfrom
feat/DX-27614
Open

cs-raj wants to merge 2 commits into
developmentfrom
feat/DX-27614

Conversation

@cs-raj

@cs-raj cs-raj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

npm-publish.yml publishes @contentstack/utils to npm with a long-lived NPM_TOKEN.

The SE1 publishing policy requires OIDC trusted publishing instead: no token, a release.yml workflow that runs when a release is published, Node 24.

The GitHub Packages job also authenticates with a personal token (GIT_TOKEN) and lacks the packages: write permission.

Fix

npm-publish.yml is renamed to release.yml. The existing guard that publishes only v-prefixed tags is kept. What changes inside it:

Before After
Trigger release: created release: published
npm auth NPM_TOKEN OIDC — id-token: write, no token
npm publish npm publish npm publish --access public; pre-releases go to the beta dist-tag, releases to latest
GitHub Packages GIT_TOKEN (personal token), no packages: write github.token with packages: write
Node / npm 22.x / npm 10 24 / latest npm
Checkout release tag, credentials persisted release tag, persist-credentials: false
Actions checkout@v4, setup-node@v4 @v7

Verification

Node 22 and Node 24: install, build, tests and npm pack all pass.

Also in this PR

ci.yml's build-test job gets checks: write and pull-requests: write so its coverage report and test reporter can post again — they have failed on every PR since 24 Sept with the default read-only token, while the tests themselves pass. The coverage action is pinned to the commit v2 resolves to today, and that file is exempted from Talisman's hex-string check in .talismanrc.

Publish on release:published from release.yml so the npm trusted publisher can
be keyed on the filename, drop NODE_AUTH_TOKEN in favour of id-token: write
(OIDC), run on Node 24 with npm@latest (trusted publishing needs npm >= 11.5.1),
check out the release tag without persisted credentials. GitHub pre-releases go
to the beta dist-tag. The existing guard that publishes only v-prefixed tags is
kept. The GitHub Packages job gains the packages: write permission it was
missing and publishes with the job's own token instead of a personal token.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 08:21
@cs-raj
cs-raj requested a review from a team as a code owner October 1, 2026 08:21
@cs-raj cs-raj self-assigned this Oct 1, 2026
@snyk-io

snyk-io Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The nonexistent checkout@v7 and setup-node@v7 versions prevent both publishing jobs from running.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Migrates package publishing to OIDC trusted publishing and GitHub-provided credentials.

Changes:

  • Publishes releases using Node 24 and npm OIDC.
  • Adds prerelease/latest npm tags and GitHub Packages permissions.
  • Renames the publishing workflow.
File Description
.github/​workflows/​release.yml Adds the revised release publishing workflow.
.github/​workflows/​npm-publish.yml Removes the token-based publishing workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +3 to +4
release:
types: [published]
The build-test job runs with the default read-only token, so the coverage
report, sticky comment and test reporter fail with "Missing checks: write"
even though the tests pass (red on every pull request since 2026-09-24).
Grant the job just what those steps need, pin the coverage action to the
commit the v2 tag resolves to today, and exempt the pinned file from
Talisman's hex-string check.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 08:33
@cs-raj
cs-raj requested a review from a team as a code owner October 1, 2026 08:33
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 99.17% 720/726
🟢 Branches 92.44% 538/582
🟢 Functions 100% 152/152
🟢 Lines 99.4% 666/670

Test suite run success

430 tests passing in 22 suites.

Report generated by 🧪jest coverage report action from 16776d0

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 99.17% 720/726
🟢 Branches 92.44% 538/582
🟢 Functions 100% 152/152
🟢 Lines 99.4% 666/670

Test suite run success

430 tests passing in 22 suites.

Report generated by 🧪jest coverage report action from 16776d0

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Talisman checksum does not match the modified CI workflow, preventing the exemption from working.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)

Comment thread .talismanrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants