Skip to content

Path to receive content from a repository's default branch #26920

@Andre601

Description

@Andre601

Feature Description

(This has been discussed a little on the discord server)

There can be situations where you want to obtain content of a repository, but don't know the name of its default branch.

As an example, if I want to display a user profile readme in an app would I first need to obtain the repository to then get the default branch from and finally the file. This can waste API calls which, especially when unauthorized, could be somewhat limited depending on what other API requests are peformed and how frequent.

Another example could be a repository where you update the default branch whenever a new major release of your project is released, which would cause old URLs to break (Should you not keep them) or link to possible outdated sources, requiring you to update them.
With this feature could you keep the same URL and it would automatically redirect to the right file on the default branch.

Regarding the "name" of the branch would I go with ~ as it works in browsers and can't be used in a branch name itself, making it a perfect candidate to have for this function, without overriding any existing branch names a user may have.

As an example, assume a repository having a branch labeled main. Using {user}/{repo}/src/branch/~/README.md would be equal to {user}/{repo}/src/branch/main/README.md.
If the repo now has its default renamed to default would {user}/{repo}/src/branch/~/README.md now be equal to {user}/{repo}/src/branch/default/README.md

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueLikely to be an easy fixproposal/acceptedWe have reviewed the proposal and agree that it should be implemented like that/at all.type/enhancementAn improvement of existing functionalitytype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions