We have a scenario today where we restore packages in CI/CD without a nuget.config file, but still need to fetch from our own GitHub NuGet feed. Being able to directly configure a package source as part of this action would significantly simplify our workflow at the moment, which looks like this:
- name: Setup NuGet
uses: nuget/setup-nuget@v4
- name: Remove Application NuGet Source
env:
Package_Source_Name: github
continue-on-error: true
run: |
nuget sources remove `
-Name $env:Package_Source_Name `
-NonInteractive
- name: Configure Application NuGet Source
env:
Package_Source_Name: github
Package_Source_Url: {our_feed_url}
run: |
nuget sources add `
-Name $env:Package_Source_Name `
-Source $env:Package_Source_Url `
-Username ${{ github.actor }} `
-Password ${{ secrets.GITHUB_TOKEN }} `
-StorePasswordInClearText `
-NonInteractive
As you can tell, this is super verbose and requires 2 actions to be "idempotent" since there is no upsert operator for sources with nuget.exe, so we "try to remove" (ignore failures) and then "add".
We will move this into a composite action to reduce noise in our main workflow, but it would be much nicer if it was possible to specify the source directly on the nuget/setup-nuget action itself, as additional parameters.
We have a scenario today where we restore packages in CI/CD without a
nuget.configfile, but still need to fetch from our own GitHub NuGet feed. Being able to directly configure a package source as part of this action would significantly simplify our workflow at the moment, which looks like this:As you can tell, this is super verbose and requires 2 actions to be "idempotent" since there is no
upsertoperator for sources withnuget.exe, so we "try to remove" (ignore failures) and then "add".We will move this into a composite action to reduce noise in our main workflow, but it would be much nicer if it was possible to specify the source directly on the
nuget/setup-nugetaction itself, as additional parameters.