Skip to content

[publish] use NuGet/login@v1 for trusted publishing - #6

Merged
sharanmoore merged 2 commits into
mainfrom
fix/nuget-login-action
Jun 22, 2026
Merged

[publish] use NuGet/login@v1 for trusted publishing#6
sharanmoore merged 2 commits into
mainfrom
fix/nuget-login-action

Conversation

@sharanmoore

@sharanmoore sharanmoore commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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@v1 action handles this exchange correctly.


What does this PR do?

Replaces the actions/github-script OIDC token fetch with NuGet/login@v1, which performs the full OIDC → temporary API key exchange that nuget.org's trusted publishing requires. The resulting key is passed to dotnet nuget push via steps.login.outputs.NUGET_API_KEY.

The user parameter required by NuGet/login@v1 is the nuget.org profile name of the account that owns the package. Rather than hardcoding a personal username, it is stored as a NUGET_USER repository 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 the GradientLabs.Api package, and update the NUGET_USER secret to point to that account instead.

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.
@sharanmoore
sharanmoore requested review from a team as code owners June 22, 2026 15:09
@sharanmoore
sharanmoore requested a review from gmtuca June 22, 2026 15:27
@sharanmoore
sharanmoore merged commit 2938dc6 into main Jun 22, 2026
7 checks passed
@sharanmoore
sharanmoore deleted the fix/nuget-login-action branch June 22, 2026 16:05
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