Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically link NuGet package to repository based on RepositoryUrl #20912

Open
Mik4sa opened this issue Aug 22, 2022 · 1 comment
Open

Automatically link NuGet package to repository based on RepositoryUrl #20912

Mik4sa opened this issue Aug 22, 2022 · 1 comment
Labels
topic/packages type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Mik4sa
Copy link

Mik4sa commented Aug 22, 2022

Feature Description

Currently there never will be a link between a (NuGet) package and a repository when publishing a package for the first time. So someone has to link it manually at the moment. I can imagine a solution, where the link happens automatically, atleast for NuGet. In .NET projects there is a field namend RepositoryUrl, which could be used to automatically link to an existing repository.

GitHub for example requires this field to be set. Otherwise it'll be rejected. You can read about that here.
Also note the Troubleshooting part there which says:

Your NuGet package may fail to push if the RepositoryUrl in .csproj is not set to the expected repository .

Maybe GitHub enforces this, because there can't be packages without a link to a repository. I'm not sure though.

Some questions we have to think about it:

  1. What would happen, if the url specified is wrong/invalid?
  2. What would happen, if the url specified is from another server/the repository doesn't exist?
  3. What would happen, if the package is already existing in gitea but isn't linked to any repository?
  4. What would happen, if the package is already existing in gitea but is linked to a diffrent repository?

I would answer these as follows:

  1. Reject the publish with a meaningful message. Something like that the url has the wrong format. Depends on what is checked here.
  2. Reject the publish with a meaningful message. Something like that the repository specified couldn't be found in that gitea instance
  3. Link the package to the specified repository
  4. Reject the publish with a meaningful message. The package link should be changed manually before (once) or the RepositoryUrl needs to be fixed. I don't prefer an automatic overwrite of the existing link because this could be a mistake and the user maybe didn't even recognized so.

EDIT: Maybe this can be adopted for other registries too. I'm not familiar with these though.

Screenshots

No response

@Mik4sa Mik4sa added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Aug 22, 2022
@KN4CK3R
Copy link
Member

KN4CK3R commented Aug 22, 2022

Yes, Github enforces this because every package needs a repository.

This issue is a "duplicate" of #20146.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/packages type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

2 participants