prref

package
v0.10.267 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package prref parses and normalizes pull-request references.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchProvider added in v0.10.266

func MatchProvider(urlProvider Provider, configured string) error

MatchProvider returns a usage-shaped error when a parsed PR URL's provider family does not match the configured git provider kind.

func ParseGitHubPullURL

func ParseGitHubPullURL(raw string) (gitprovider.PRRef, error)

ParseGitHubPullURL parses the v1 GitHub pull-request URL form.

func ParseGitLabMergeRequestURL added in v0.10.266

func ParseGitLabMergeRequestURL(raw string) (gitprovider.PRRef, error)

ParseGitLabMergeRequestURL parses a GitLab merge-request URL. Both the canonical `/-/merge_requests/<iid>` form and the legacy form without the `/-/` separator are accepted, and namespaces may be nested, so the parsed owner can contain slashes (for example `group/subgroup`).

func SameHost

func SameHost(left, right string) bool

SameHost reports whether two host strings identify the same host.

func ShortSHA added in v0.10.231

func ShortSHA(sha string) string

ShortSHA returns the SHA trimmed of surrounding whitespace and truncated to 12 characters.

Types

type Provider added in v0.10.266

type Provider string

Provider identifies the git-host URL family a pull-request reference was parsed from.

const (
	ProviderGitHub Provider = "github"
	ProviderGitLab Provider = "gitlab"
)

Providers recognized by ParsePullURL.

func ParsePullURL added in v0.10.266

func ParsePullURL(raw string) (gitprovider.PRRef, Provider, error)

ParsePullURL parses a GitHub pull-request URL or a GitLab merge-request URL and reports which provider family the URL belongs to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL