I have a .NET project that uses a private Nuget package that is hosted in Azure DevOps. I have a Github Actions workflow that registers the private feed with a personal access token, and restores the packages in the solution.This action fails with error NU1301: Unable to load the service index for source
I have ensured that the feed is enabled, and that the personal access token has read rights on the Azure Artifact.
name: testson: workflow_dispatch: workflow_call: inputs: projectName: description: "Project name" required: true type: string secrets: PAT: required: true USER: required: trueenv: DOTNET_VERSION: "7.0.x"jobs: unit-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup dotnet uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} - name: Run tests working-directory: ./Solution run: | dotnet nuget update source private-source-name --source ${{ vars.PACKAGE_URL }} --username ${{ secrets.USER }} --password ${{ secrets.PAT }} --store-password-in-clear-text dotnet restore dotnet test Solution.Test.${{ inputs.projectName }}
I have tried to register the feed and restore as per dotnet documentation, both from solution-level NuGet.Config, as well as top level NuGet.Config, and ensured the config is correctly set up:
<?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="private-source-name" value="private-source" /></packageSources><packageSourceCredentials><private-source-name><add key="Username" value="<username>" /><add key="ClearTextPassword" value="<clear-text-PAT>" /></private-source-name></packageSourceCredentials></configuration>
follwed by dotnet restore
in the Solution. I have also done it with nuget restore
from the specified config files.