Skip to content

chore(ci): gate npm publishing behind npm-publish environment and admin check - #7675

Merged
KATT merged 1 commit into
mainfrom
ci/gate-npm-publish
Oct 18, 2026
Merged

KATT merged 1 commit into
mainfrom
ci/gate-npm-publish

Conversation

@KATT

@KATT KATT commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Closes #

🎯 Changes

Restricts who can publish to npm from CI:

  • Both release jobs now run in the new npm-publish GitHub environment, which only allows deployments from main. The npm trusted publisher config for each package is being re-bound to this environment, so npm only accepts OIDC tokens from jobs running in npm-publish on main. Previously any branch running release.yml could get a valid publish token.
  • The stable publish job first checks that github.triggering_actor has admin permission on the repo (currently the trpc-godmode members) and fails before checkout otherwise.
  • Canary publishing on push to main stays automatic.

Follow-ups outside this PR:

  • Re-run the npm trust refresh with --env npm-publish on all published packages.
  • Consider moving ACCESS_TOKEN from a repository secret to an npm-publish environment secret, so workflows on other branches can't read it.

Note: publishing to @trpc/* is still blocked independently by a Cloudflare rule on npm's side (PUT /@trpc/* returns a "you have been blocked" page). This PR doesn't fix that.

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

Summary by CodeRabbit

  • Chores
    • Stable and canary releases now use the npm-publish environment.
    • Stable publishing is blocked when triggered by someone without repository admin permission.

@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
next-prisma-starter Ready Ready Preview Oct 17, 2026 4:07pm UTC
og-image Ready Ready Preview Oct 17, 2026 4:07pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack β†’

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration
  • Configuration used: Repository: trpc/trpc/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f1beab7-e970-41e1-a03e-997cf945520a
πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6d92747 and c0dbaf1.

πŸ“’ Files selected for processing: 1
  • .github/workflows/release.yml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

πŸ“ Walkthrough

The release workflow assigns the stable and canary publish jobs to the npm-publish environment. The stable job checks the triggering actor’s repository permission and stops before publishing if it is not admin.

Changes: Release publishing

Layer / File(s) Summary
Publishing environment and permission check
.github/workflows/release.yml
Both publish jobs target the npm-publish environment. The stable job checks the triggering actor’s repository permission and exits with status 1 if it is not admin.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: nick-lucas

Merge Risk: βšͺ Minimal Β· up to c0dba

The changed release controls have no demonstrated new blocker. The canary registry rejection predates this change; confirm the separate npm trust setup before relying on the new environment for future publishing.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main CI change: restricting npm publishing through the npm-publish environment and an admin permission check.
Description check Passed The description explains the publishing changes, security intent, follow-ups, limitations, and checklist status. The issue reference remains blank, and documentation and test checklist items are unche…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the publishing changes, security intent, follow-ups, limitations, and checklist status. The issue reference remains blank, and documentation and test checklist items are unchecked, but these omissions are non-critical for this CI-only change.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

@KATT
KATT added this pull request to the merge queue Oct 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

πŸ”΅ Needs a closer look

The security guarantees depend on main-only environment restrictions and npm trusted-publisher bindings that require human verification.

No open issues πŸŽ‰

What changed in this PR

Tightens CI controls for npm publishing while keeping canary releases automatic on pushes to main.

Changes:

  • Assigns both release jobs to the npm-publish environment.
  • Requires the triggering user to have repository admin permission before stable-release checkout.
File Description
.github/​workflows/​release.yml Adds publishing environment bindings and a stable-release admin check.

Review effort: Balanced

@pkg-pr-new

pkg-pr-new Bot commented Oct 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/@trpc/client@7675

@trpc/next

npm i https://pkg.pr.new/@trpc/next@7675

@trpc/openapi

npm i https://pkg.pr.new/@trpc/openapi@7675

@trpc/react-query

npm i https://pkg.pr.new/@trpc/react-query@7675

@trpc/server

npm i https://pkg.pr.new/@trpc/server@7675

@trpc/tanstack-react-query

npm i https://pkg.pr.new/@trpc/tanstack-react-query@7675

@trpc/upgrade

npm i https://pkg.pr.new/@trpc/upgrade@7675

commit: c0dbaf1

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 17, 2026
@KATT
KATT added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 17, 2026
@KATT KATT mentioned this pull request Oct 18, 2026
1 of 3 tasks
@KATT
KATT added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 2c331e8 Oct 18, 2026
52 checks passed
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-trpc__trpc that referenced this pull request Oct 18, 2026
## 🎯 Changes

The merge queue never merges anything: none of the workflows that
produce required status checks trigger on `merge_group`, and most
`main.yml` jobs were gated to `pull_request`. Only the Vercel checks
report on the queue commit, so entries sit until they're kicked out with
`checks_timed_out` β€” this happened twice each to trpc#7672 and trpc#7675.

- `main.yml`: trigger on `merge_group`; build, typecheck, typecheck-www
and all E2E jobs now run for `pull_request` or `merge_group`. `Release
using pkg.pr.new` is skipped in the queue.
- `lint.yml`: trigger on `merge_group`; lint/fix steps still run, but
instead of the autofix.ci commit (which can't push to a queue branch)
the job fails if `git diff` is non-empty.
- `semantic-pr.yml`: trigger on `merge_group` with the job skipped there
(the title is already validated on the PR), so the required `test title`
check reports as passing.

Once merged, trpc#7672 and trpc#7675 can be re-queued.

## βœ… Checklist

- [x] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.

Made with [Cursor](https://cursor.com)

Co-authored-by: Cursor <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 19, 2026

This branch was successfully deployed

5 active deployments
Preview – www β€” c0dbaf1c Deployed Oct 17, 2026 by vercel[bot]
Preview – og-image β€” c0dbaf1c Deployed Oct 17, 2026 by vercel[bot]
Preview – examples-todomvc β€” c0dbaf1c Deployed Oct 17, 2026 by vercel[bot]
Preview – next-prisma-starter β€” c0dbaf1c Deployed Oct 17, 2026 by vercel[bot]
Preview – trpc-next-app-dir β€” c0dbaf1c Deployed Oct 17, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants