Skip to content

v1.0.35 - #95

Merged
yilmaztayfun merged 2 commits into
release-v1.0from
master
Aug 14, 2026
Merged

v1.0.35#95
yilmaztayfun merged 2 commits into
release-v1.0from
master

Conversation

@yilmaztayfun

@yilmaztayfun yilmaztayfun commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Adopt NuGet.org Trusted Publishing via GitHub OIDC for the NuGet publish workflow.

CI:

  • Grant id-token write permission and integrate NuGet/login to obtain a short-lived NuGet API key at publish time.
  • Update publish step to consume the OIDC-derived API key and improve failure messaging and configuration checklist.

yilmaztayfun and others added 2 commits August 14, 2026 14:54
Replace the long-lived NUGET_API_KEY repository secret with OIDC-based
Trusted Publishing, so no durable credential is stored in GitHub.

- Grant the workflow `id-token: write` so GitHub can issue an OIDC token.
- Add a `NuGet/login@v1` step immediately before the push. The temporary
  API key nuget.org returns is valid for one hour and single-use, so it
  is requested after build/test/pack rather than at the top of the job.
- Feed the push from `steps.nuget-login.outputs.NUGET_API_KEY` and replace
  the old "secret not configured" guard with a checklist that points at
  the likely policy mismatch when the token exchange yields no key.

The nuget.org policy is bound to this workflow's file name, so renaming
publish-nuget.yml requires updating the policy as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ci(nuget): switch publishing to NuGet.org Trusted Publishing
@yilmaztayfun yilmaztayfun self-assigned this Aug 14, 2026
@yilmaztayfun
yilmaztayfun requested review from a team August 14, 2026 11:55
@sourcery-ai

sourcery-ai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR updates the NuGet publish GitHub Actions workflow to use NuGet.org Trusted Publishing via OIDC, replacing the static API key secret with a short-lived key obtained at runtime and adding more targeted diagnostics if the login fails.

Sequence diagram for NuGet.org Trusted Publishing via OIDC

sequenceDiagram
    participant GitHubActions as GitHubActionsWorkflow
    participant NuGetLogin as NuGet_login_action
    participant NuGetOrg as NuGet_org
    participant PublishStep as Publish_to_NuGet_org_step

    GitHubActions->>NuGetLogin: execute NuGet/login@v1 with user NUGET_USER
    NuGetLogin->>NuGetOrg: exchange OIDC id-token for short-lived API key
    NuGetOrg-->>NuGetLogin: return NUGET_API_KEY (1 hour, single-use)
    NuGetLogin-->>GitHubActions: set output NUGET_API_KEY
    GitHubActions->>PublishStep: start publish step with env NUGET_API_KEY
    PublishStep->>PublishStep: check NUGET_API_KEY is non-empty
    PublishStep->>NuGetOrg: push packages using short-lived NUGET_API_KEY
Loading

File-Level Changes

Change Details Files
Switch NuGet publishing from a long-lived API key secret to NuGet.org Trusted Publishing via OIDC with a short-lived API key.
  • Grant id-token: write permission in the workflow to allow OIDC token issuance.
  • Add a NuGet/login@v1 step that exchanges the GitHub OIDC token for a short-lived NuGet API key, using the NUGET_USER secret for NuGet.org identity.
  • Update the publish step to read NUGET_API_KEY from the NuGet/login step output instead of a repository secret.
  • Improve the API key validation message to guide debugging of Trusted Publishing configuration (NUGET_USER, owner/repo/workflow policy, id-token permission).
.github/workflows/publish-nuget.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@yilmaztayfun
yilmaztayfun merged commit 3215228 into release-v1.0 Aug 14, 2026
3 of 5 checks passed
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9cf0d575-f6ab-44ef-880b-4f3a766dacf8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue, and left some high level feedback:

  • Consider scoping id-token: write to just the build-and-publish job instead of the entire workflow to minimize the blast radius of OIDC permissions.
  • You may want to fail fast at the workflow level with if: steps.nuget-login.outputs.NUGET_API_KEY == '' on the publish step rather than relying only on the shell check inside the script.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider scoping `id-token: write` to just the `build-and-publish` job instead of the entire workflow to minimize the blast radius of OIDC permissions.
- You may want to fail fast at the workflow level with `if: steps.nuget-login.outputs.NUGET_API_KEY == ''` on the publish step rather than relying only on the shell check inside the script.

## Individual Comments

### Comment 1
<location path=".github/workflows/publish-nuget.yml" line_range="239" />
<code_context>
+          echo "Checklist:"
+          echo "  - NUGET_USER secret must be your nuget.org profile name (not e-mail)"
+          echo "  - nuget.org Trusted Publishing policy must match:"
+          echo "      owner=${{ github.repository_owner }}, repo=${{ github.event.repository.name }}, workflow=publish-nuget.yml"
+          echo "  - Job must have 'id-token: write' permission"
           exit 1
</code_context>
<issue_to_address>
**suggestion:** Avoid hard‑coding the workflow file name and prefer `github.workflow`/`github.repository` for the diagnostic message.

This checklist line hard-codes `workflow=publish-nuget.yml` and relies on `github.event.repository.name`, which isn’t available for all event types and could break if triggers change. Using `workflow=${{ github.workflow }}` and `repo=${{ github.repository }}` keeps the message accurate and robust if the workflow file is renamed or the event type changes, without requiring manual updates to the text.

```suggestion
          echo "      owner=${{ github.repository_owner }}, repo=${{ github.repository }}, workflow=${{ github.workflow }}"
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

echo "Checklist:"
echo " - NUGET_USER secret must be your nuget.org profile name (not e-mail)"
echo " - nuget.org Trusted Publishing policy must match:"
echo " owner=${{ github.repository_owner }}, repo=${{ github.event.repository.name }}, workflow=publish-nuget.yml"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Avoid hard‑coding the workflow file name and prefer github.workflow/github.repository for the diagnostic message.

This checklist line hard-codes workflow=publish-nuget.yml and relies on github.event.repository.name, which isn’t available for all event types and could break if triggers change. Using workflow=${{ github.workflow }} and repo=${{ github.repository }} keeps the message accurate and robust if the workflow file is renamed or the event type changes, without requiring manual updates to the text.

Suggested change
echo " owner=${{ github.repository_owner }}, repo=${{ github.event.repository.name }}, workflow=publish-nuget.yml"
echo " owner=${{ github.repository_owner }}, repo=${{ github.repository }}, workflow=${{ github.workflow }}"

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant