Skip to content

Automatically link NuGet package to repository based on RepositoryUrl #20912

Open
@Mik4sa

Description

@Mik4sa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/packagestype/featureCompletely new functionality. Can only be merged if feature freeze is not active.type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions