Skip to content

GH4945: Add GitHub Actions NuGetLogin for OIDC - #4946

Merged
gep13 merged 1 commit into
cake-build:developfrom
devlead:feature/gh-4945
Jul 17, 2026
Merged

GH4945: Add GitHub Actions NuGetLogin for OIDC#4946
gep13 merged 1 commit into
cake-build:developfrom
devlead:feature/gh-4945

Conversation

@devlead

@devlead devlead commented Jul 16, 2026

Copy link
Copy Markdown
Member

Add GitHubActionsCommands.NuGetLogin to exchange a GitHub Actions OIDC identity token for a short-lived NuGet.org API key, enabling trusted publishing from Cake scripts without storing long-lived credentials.

  • Add GitHubNuGetLoginSettings with defaults for NuGet token service URL and OIDC audience
  • Add internal GitHubNuGetLoginService to request the OIDC JWT from GitHub and exchange it with the NuGet token service
  • Add source-generated JSON models and serialization context for OIDC and token exchange payloads
  • Wire NuGetLogin overloads on GitHubActionsCommands (username-only and settings-based)
  • Add unit tests with a fake HttpMessageHandler fixture covering success, validation, and HTTP failure paths
  • Add optional GitHub Actions integration test gated on CAKE_INTEGRATIONTEST_NUGET_USERNAME
  • Integration test Validate NuGetLogin API key with nuget.org verify-scope protocol Extend the GitHub Actions NuGetLogin integration test to confirm the OIDC-exchanged API key is accepted by nuget.org using the verify-scope create-verification-key and verifykey APIs.
  • fixes Add GitHub Actions NuGetLogin for OIDC trusted publishing #4945

Add `GitHubActionsCommands.NuGetLogin` to exchange a GitHub Actions OIDC
identity token for a short-lived NuGet.org API key, enabling trusted publishing
from Cake scripts without storing long-lived credentials.

- Add `GitHubNuGetLoginSettings` with defaults for NuGet token service URL and OIDC audience
- Add internal `GitHubNuGetLoginService` to request the OIDC JWT from GitHub and exchange it with the NuGet token service
- Add source-generated JSON models and serialization context for OIDC and token exchange payloads
- Wire `NuGetLogin` overloads on `GitHubActionsCommands` (username-only and settings-based)
- Add unit tests with a fake `HttpMessageHandler` fixture covering success, validation, and HTTP failure paths
- Add optional GitHub Actions integration test gated on `CAKE_INTEGRATIONTEST_NUGET_USERNAME`
- Integration test Validate NuGetLogin API key with nuget.org verify-scope protocol Extend the GitHub Actions NuGetLogin integration test to confirm the OIDC-exchanged API key is accepted by nuget.org using the verify-scope create-verification-key and
verifykey APIs.
- fixes cake-build#4945
@devlead
devlead requested a review from gep13 July 16, 2026 14:38

@gep13 gep13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@gep13

gep13 commented Jul 17, 2026

Copy link
Copy Markdown
Member

@devlead this is a great addition, thanks for getting this added!

@gep13
gep13 merged commit 59eb19d into cake-build:develop Jul 17, 2026
18 checks passed
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.

Add GitHub Actions NuGetLogin for OIDC trusted publishing

2 participants