version_bump/repo_url

Pure parsing of git remote URLs into host + owner + repo.

Shared by the forge plugins: github only needs owner/repo, while forgejo also needs the host so it can derive the API base URL of a self-hosted instance. Handles the common remote forms:

The trailing .git suffix and trailing slashes are stripped; extra path segments after the repository name are ignored.

Types

A parsed repository reference. host keeps an explicit :port when an http(s) URL carries one (e.g. a self-hosted forge on a non-standard port).

pub type RepoRef {
  RepoRef(host: String, owner: String, repo: String)
}

Constructors

  • RepoRef(host: String, owner: String, repo: String)

Values

pub fn parse(url: String) -> Result(RepoRef, Nil)

Extract host, owner and repo from a git remote URL.

Search Document