actions / actions/setup-dotnet

Automatically auth package source mapping that match source-url

Open
#543 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
TypeScript
Stars
1.2k
Forks
572
Avg merge
12d 20h
Merged PRs (30d)
1

Description

Description:
When NuGet.Config contains a package source that matches source-url, automatically auth that source correctly.

Justification:
Currently a user may have the following step in their Action:

- uses: actions/setup-dotnet@v4
  with:
    dotnet-version: 8.x.x
    source-url: https://nuget.pkg.github.com/example/index.json
  env:
    NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

And a NuGet.Config with the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="github" value="https://nuget.pkg.github.com/example/index.json" />
  </packageSources>
<packageSourceMapping>
    <packageSource key="nuget.org">
      <package pattern="*" />
    </packageSource>
    <packageSource key="github">
      <package pattern="Example.*" />
    </packageSource>
  </packageSourceMapping>
</configuration>

Nuget restore will fail with authorization errors, which is unexpected since they provided a source-url and NUGET_AUTH_TOKEN.

They have to manually auth the mapping:

- name: dotnet
  run: dotnet ...
  env:
    NuGetPackageSourceCredentials_github: Username=${{ github.actor }};Password=${{ secrets.GITHUB_TOKEN }}

The setup-dotnet should automatically fixup the auth for mappings that match the provided source-url

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the action processes the source-url input and configures NuGet authentication; the issue does not name a file or test. Verify the behavior with a NuGet.Config packageSourceMapping entry whose URL matches source-url, and confirm restore succeeds using the provided NUGET_AUTH_TOKEN without manual mapping credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.