a NET6 project on GitHub cannot be dotnet-restored in GitHub Actions. dotnet restore
works fine locally. Looking at the Action logs, it seems GH looks for Microsoft dependencies in my GitHub Packages Repo. System.Linq
is MS-stuff.
Retrying 'FindPackagesByIdAsync' for source 'https://nuget.pkg.github.com/mdddev/download/system.linq/index.json'.
Response status code does not indicate success: 401 (Unauthorized).
/home/runner/.dotnet/sdk/6.0.202/NuGet.targets(130,5): warning : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured. [/home/runner/work/meh/meh/meh.sln]
Further below in the pipeline there is a step to publish the result to the GitHub Packages registry, however in the project itself I am only using public NuGet references. I am not sure why GH Actions looks for the .NET stuff in my registry. I even have the public NuGet feed configured in my nuget.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/mdddev/index.json" />
</packageSources>
</configuration>
Does anyone know what's the problem here?
You are using GitHub packages here, you have to authenticate yourself.
for more info -> https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry#authenticating-with-a-personal-access-token