[publish] use NuGet/login@v1 for trusted publishing - #6
Merged
Conversation
Replace manual OIDC token fetch with the NuGet/login action which handles the full token exchange with nuget.org and returns a short-lived API key.
gmtuca
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack Overview
The publish workflow was failing with 403 because we were manually fetching the OIDC token and passing it directly as an API key. NuGet trusted publishing requires a two-step process — the workflow sends the OIDC token to nuget.org, which validates it and returns a short-lived API key. The
NuGet/login@v1action handles this exchange correctly.What does this PR do?
Replaces the
actions/github-scriptOIDC token fetch withNuGet/login@v1, which performs the full OIDC → temporary API key exchange that nuget.org's trusted publishing requires. The resulting key is passed todotnet nuget pushviasteps.login.outputs.NUGET_API_KEY.The
userparameter required byNuGet/login@v1is the nuget.org profile name of the account that owns the package. Rather than hardcoding a personal username, it is stored as aNUGET_USERrepository secret. This is a short-term pragmatic solution — the proper fix is to create a dedicated nuget.org bot account (e.g.gradientlabs-bot), add it as a co-owner of theGradientLabs.Apipackage, and update theNUGET_USERsecret to point to that account instead.