Skip to content

Switch NuGet publish to trusted publishing (OIDC)#39

Merged
dampee merged 2 commits into
mainfrom
claude/vibrant-elion-10a4d8
Jun 14, 2026
Merged

Switch NuGet publish to trusted publishing (OIDC)#39
dampee merged 2 commits into
mainfrom
claude/vibrant-elion-10a4d8

Conversation

@dampee

@dampee dampee commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds id-token: write permission to the job so GitHub Actions can issue an OIDC token
  • Removes the NUGET_API_KEY secret and --api-key flag from the push step
  • NuGet validates the OIDC token against the trusted publisher policy (dotnet.yml / roodfluweel/paynl-csharp-sdk)

Test plan

  • Merge to main (or push a release/v* tag) and confirm the Push Nuget step completes without an API key secret
  • Remove the NUGET_PUBLISH_KEY secret from repo settings once a successful publish is confirmed

🤖 Generated with Claude Code

Replace API key secret with GitHub OIDC trusted publishing.
Adds id-token: write permission so the runner can obtain an OIDC
token that NuGet validates against the configured trusted publisher
policy, removing the need for a stored NUGET_PUBLISH_KEY secret.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 14, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GitHub Actions NuGet publishing workflow to use NuGet.org trusted publishing via GitHub OIDC instead of a long-lived NUGET_PUBLISH_KEY secret.

Changes:

  • Adds id-token: write and contents: read job permissions to enable OIDC token issuance.
  • Removes the NUGET_PUBLISH_KEY secret usage and the --api-key flag from dotnet nuget push.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/dotnet.yml Outdated
Comment thread .github/workflows/dotnet.yml Outdated
- Move NuGet push into a dedicated publish job with needs: build
  so id-token: write is never granted during PR builds
- Fetch the OIDC token (audience api.nuget.org) via actions/github-script
  and pass it as --api-key so the push authenticates correctly
- Pass packages between jobs via upload/download-artifact@v4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dampee
dampee merged commit d6c35b5 into main Jun 14, 2026
2 checks passed
@dampee
dampee deleted the claude/vibrant-elion-10a4d8 branch June 14, 2026 20:20
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