Skip to content

[QUESTION] Trusted Publishing with re-usable GitHub Workflows #1755

Open

Description

@OS-pedrogustavobilro

Hey everyone!

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.

Per the last paragraph in Troubleshooting section

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.

Activity

  1. ssozinov commented on Nov 14, 2025

    @ssozinov

    I have same issue

  2. ljharb commented on Nov 15, 2025

    @ljharb
    Contributor

    You shouldn't use it right now. See the OpenJS Foundation's latest blog post: https://openjsf.org/blog/publishing-securely-on-npm

  3. tibotiber commented on Dec 11, 2025

    @tibotiber

    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?

  4. tibotiber commented on May 20, 2026

    @tibotiber

    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:

    1. 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.
    2. 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.
    3. 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.

  5. ljharb commented on May 20, 2026

    @ljharb
    Contributor

    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.

  6. almagueraloshua12-sudo commented on May 21, 2026

    @almagueraloshua12-sudo
  7. schjetne commented on Jun 19, 2026

    @schjetne

    Is there a timeline on this yet?

  8. added a commit that references this issue on Aug 11, 2026
  9. tibotiber commented on Nov 23, 2026

    @tibotiber

    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 :).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions