feat: csharp-publish composite action for NuGet Trusted Publishing - #15
Merged
Merged
Conversation
A reusable workflow runs its OIDC job in peacefulstudio/github-actions, so job_workflow_ref is stamped 'github-actions' and a per-repo nuget Trusted Publishing policy on the consumer can never match (live HTTP 401). Move OIDC login into the caller and ship build/test/pack/push as a composite action invoked via 'steps: - uses:'. Running inline in the caller's job keeps job_workflow_ref on the caller's publish workflow, so per-repo policies match. The action does not checkout the consumer repo or mint its own OIDC token; the caller does both. Deprecate csharp-publish-public.yaml: it cannot satisfy trusted publishing for any consumer for the same job_workflow_ref reason.
Contributor
Author
|
@claude please review this PR. |
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.
Root cause
csharp-publish-public.yamlwas migrated to NuGet Trusted Publishing (OIDC), but as a reusable workflow its OIDC job runs inpeacefulstudio/github-actions. Thejob_workflow_refclaim is therefore always stampedpeacefulstudio/github-actions/.github/workflows/csharp-publish-public.yaml@<ref>— never the caller. A per-repo nuget Trusted Publishing policy anchored on the consumer repo can never match this claim. Confirmed by a live HTTP 401.Fix
Move OIDC login into the caller and keep build/test/pack/push complexity in a composite action that runs inline as steps in the caller's job. Running inline means
job_workflow_refstays the caller'spublish.yaml, so a per-repo nuget policy anchored on the consumer matches.New
.github/actions/csharp-publish/action.yml— composite action (invoked viasteps: - uses:, notjobs.*.uses:).NuGet/login— the caller mints the short-lived key and passes it via theapi-keyinput.scripts/push-nuget.sh.api-key(required),version_override,include_symbols(defaulttrue),working-directory(default.),test-filter(default empty).Deprecate
csharp-publish-public.yaml— it cannot satisfy trusted publishing for any consumer (samejob_workflow_refreason). Marked[DEPRECATED]inname:, with a leading::warning::step pointing consumers to the composite action. Otherwise left functional.Caller usage:
Note
.github/changes require a human maintainer to merge — bot auto-approval is held for this path.