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
{{ message }}
Repository navigation
[QUESTION] Trusted Publishing with re-usable GitHub Workflows #1755
I have a question regarding Trusted Publishers that from reading the docs doesn't seem very clear to me.
We have some repositories that have multiple GitHub actions for publishing packages to npm, one to dev tag, one to next, one to latest (and a few others). These workflows all consume a re-usable workflow, where the call to npm publish actually takes place.
Some GitHub Actions workflows use workflow_call to invoke other workflows that run npm publish, or use workflow_dispatch for manual publishing. When this happens, validation checks the calling workflow's name instead of the workflow that actually contains the publish command, which can cause configuration mismatches.
So I am confused as to how can we use trusted publishing when we have a setup like:
workflow_a.yml
workflow_b.yml
workflow_c.yml
That all call workflow_reusable.yml (workflow_call), without changing the setup of the workflows?
So far I've been only able to get it working if I set the GitHub Workflow file in npm settings as one of the specific a,b,c workflows, and paste the reusable code inside the calling workflow.
Would I need to always use a single Github Actions workflow file to enable trusted publishing?
Let me know if you need me to clarify anything.
Reacted by tom goriunov, David Knaack, Sergei Semko, Sergey Sozinov, Thibaut Tiberghien, Neven Marić, Oleksandr Danylchenko, Sergei S. Betke, Michael Beckemeyer, ObserverOfTime and 1 more
This seems pretty strange that we're forced into a change that doesn't yet support a pattern of publishing very common in CI pipelines: a github action with workflow_call. Which means we're forced into using tokens with a 90 days rotation cycle. Could npm at the very least support multiple trusted publishers?
Reacted by Sergei Semko, tom goriunov, Oleksandr Danylchenko, Michael Beckemeyer and Philipp Pracht
Adding some context that makes this more urgent: npm is now actively emailing maintainers asking them to move to trusted publishing as a response to the Mini Shai-Hulud supply chain attacks. The recommendation is clear and reasonable. The problem is that for any project using a reusable workflow_call pattern, which is the standard way to avoid duplicating CI logic across multiple calling workflows. There's no viable path to comply.
My setup has been ready for months: id-token: write permissions set, npm updated to 11.5.1+, the infrastructure is all in place. The only blocker is this limitation.
A few concrete directions that would unblock this:
Allow multiple trusted publishers per package — the most straightforward fix. Let maintainers register deploy-dev.yml, deploy-prod.yml, etc. as separate trusted publishers for the same package.
Validate the reusable workflow ref — use job_workflow_ref (which reflects the actual workflow running npm publish) rather than the calling workflow's name, or support both.
Allow wildcard workflow paths — e.g., any workflow in the same repo can publish, scoped by repo + owner.
Is any of this on the roadmap? Given that npm is actively pushing users toward trusted publishing while this remains broken for common CI patterns, a clear answer on timeline would be really helpful.
Reacted by Michael Beckemeyer, Oleksandr Danylchenko, tom goriunov, Tobias Lønnerød Madsen, ObserverOfTime, Yihao Gao and Michael Mortensen
To be clear, it's only reasonable as an alternative to token-based one-factor publishing (ie, from CI); until staged publishing exists, local publishing with 2FA is the only secure mechanism to publish.
Update for anyone with a reusable workflow_call setup. Since 3 September npm accepts several trusted publisher configurations on one package, so each calling workflow can be registered with its own file name and environment. Tested it today and it works :).
Reacted by tom goriunov, Mathieu Westphal and Oleksandr Danylchenko
Activity
ssozinov commentedon Nov 14, 2025
I have same issue
ljharb commentedon Nov 15, 2025
You shouldn't use it right now. See the OpenJS Foundation's latest blog post: https://openjsf.org/blog/publishing-securely-on-npm
tibotiber commentedon Dec 11, 2025
This seems pretty strange that we're forced into a change that doesn't yet support a pattern of publishing very common in CI pipelines: a github action with
workflow_call. Which means we're forced into using tokens with a 90 days rotation cycle. Could npm at the very least support multiple trusted publishers?Inline npm publish into release.yml, delete deploy.yml
docs: correct reusable-workflow trust boundary; drop debug verbosity
fix(ci): inline publish step into release-please workflow (#19)
tibotiber commentedon May 20, 2026
Adding some context that makes this more urgent: npm is now actively emailing maintainers asking them to move to trusted publishing as a response to the Mini Shai-Hulud supply chain attacks. The recommendation is clear and reasonable. The problem is that for any project using a reusable
workflow_callpattern, which is the standard way to avoid duplicating CI logic across multiple calling workflows. There's no viable path to comply.My setup has been ready for months:
id-token: writepermissions set, npm updated to 11.5.1+, the infrastructure is all in place. The only blocker is this limitation.A few concrete directions that would unblock this:
deploy-dev.yml,deploy-prod.yml, etc. as separate trusted publishers for the same package.job_workflow_ref(which reflects the actual workflow running npm publish) rather than the calling workflow's name, or support both.Is any of this on the roadmap? Given that npm is actively pushing users toward trusted publishing while this remains broken for common CI patterns, a clear answer on timeline would be really helpful.
ljharb commentedon May 20, 2026
To be clear, it's only reasonable as an alternative to token-based one-factor publishing (ie, from CI); until staged publishing exists, local publishing with 2FA is the only secure mechanism to publish.
almagueraloshua12-sudo commentedon May 21, 2026
Keep preview publishing on NPM_TOKEN (revert OIDC for preview) (#948)
ci: 🎡 unified beta and main workflow to use trusted publishing
schjetne commentedon Jun 19, 2026
Is there a timeline on this yet?
ci(pipeline): fold release into the post-merge DAG
docs(workflow): cite npm trusted-publishing rules
docs: rewrite README, add compatibility docs, unify post-merge CI (#467)
D5
ci: register the trusted publisher on the entry workflow
tibotiber commentedon Nov 23, 2026
Update for anyone with a reusable
workflow_callsetup. Since 3 September npm accepts several trusted publisher configurations on one package, so each calling workflow can be registered with its own file name and environment. Tested it today and it works :).