provider

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package provider defines the VCS provider interface and implementations for interacting with GitHub and GitLab APIs.

Index

Constants

View Source
const DefaultGitHubHost = "github.com"
View Source
const DefaultGitLabHost = "gitlab.com"
View Source
const ReleaseLabelPending = "autorelease: pending"
View Source
const ReleaseLabelTagged = "autorelease: tagged"

Variables

View Source
var ErrCommitBoundaryNotFound = errors.New("commit boundary not found")

ErrCommitBoundaryNotFound reports that the requested base ref is not reachable from the target branch history.

View Source
var ErrEmptyCommitID = errors.New("empty commit ID")
View Source
var ErrEmptyCommitSHA = errors.New("empty commit SHA")
View Source
var ErrFileNotFound = errors.New("file not found")
View Source
var ErrMergeBlocked = errors.New("release PR merge blocked")
View Source
var ErrMergeMethodUnsupported = errors.New("merge method unsupported")
View Source
var ErrNoPR = errors.New("no release PR found")
View Source
var ErrNoRelease = errors.New("no release found")
View Source
var ErrNoVersionRef = errors.New("no version ref found")
View Source
var ErrUnknownRemote = errors.New("unable to parse remote URL")
View Source
var ErrUnsupportedHost = errors.New("unsupported remote host")

Functions

func DetectProviderType added in v0.1.3

func DetectProviderType(host string) (string, error)

func ParseCommits

func ParseCommits(entries []CommitEntry) []commit.Commit

Types

type CommitBoundaryNotFoundError added in v0.1.3

type CommitBoundaryNotFoundError struct {
	Ref    string
	Branch string
}

CommitBoundaryNotFoundError includes the missing boundary ref and the branch being analyzed.

func (*CommitBoundaryNotFoundError) Error added in v0.1.3

func (*CommitBoundaryNotFoundError) Unwrap added in v0.1.3

func (e *CommitBoundaryNotFoundError) Unwrap() error

type CommitEntry

type CommitEntry struct {
	Hash    string
	Message string
	Paths   []string
}

type GitHub

type GitHub struct {
	// contains filtered or unexported fields
}

func NewGitHub

func NewGitHub(client *github.Client, owner, repo string) *GitHub

func (*GitHub) CreateBranch

func (g *GitHub) CreateBranch(ctx context.Context, name, base string) error

func (*GitHub) CreateRelease

func (g *GitHub) CreateRelease(ctx context.Context, opts ReleaseOptions) (*Release, error)

func (*GitHub) CreateReleasePR

func (g *GitHub) CreateReleasePR(ctx context.Context, opts ReleasePROptions) (*PullRequest, error)

func (*GitHub) FindMergedReleasePR

func (g *GitHub) FindMergedReleasePR(ctx context.Context, baseBranch string) (*PullRequest, error)

func (*GitHub) FindOpenPendingReleasePRs

func (g *GitHub) FindOpenPendingReleasePRs(ctx context.Context, baseBranch string) ([]*PullRequest, error)

func (*GitHub) GetCommitsSince

func (g *GitHub) GetCommitsSince(ctx context.Context, ref, branch string, includePaths bool) ([]CommitEntry, error)

func (*GitHub) GetFile

func (g *GitHub) GetFile(ctx context.Context, branch, path string) (string, error)

func (*GitHub) GetLatestVersionRef added in v0.2.2

func (g *GitHub) GetLatestVersionRef(ctx context.Context) (string, error)

func (*GitHub) GetReleaseByTag added in v0.2.2

func (g *GitHub) GetReleaseByTag(ctx context.Context, tag string) (*Release, error)

func (*GitHub) ListTags added in v0.2.2

func (g *GitHub) ListTags(ctx context.Context) ([]string, error)

func (*GitHub) MarkReleasePRPending

func (g *GitHub) MarkReleasePRPending(ctx context.Context, number int) error

func (*GitHub) MarkReleasePRTagged

func (g *GitHub) MarkReleasePRTagged(ctx context.Context, number int) error

func (*GitHub) MergeReleasePR added in v0.1.2

func (g *GitHub) MergeReleasePR(ctx context.Context, number int, opts MergeReleasePROptions) error

func (*GitHub) PathPrefix

func (g *GitHub) PathPrefix() string

func (*GitHub) RepoURL

func (g *GitHub) RepoURL() string

func (*GitHub) TagExists added in v0.2.2

func (g *GitHub) TagExists(ctx context.Context, tag string) (bool, error)

func (*GitHub) UpdateFiles

func (g *GitHub) UpdateFiles(ctx context.Context, branch, base string, files map[string]string, message string) error

func (*GitHub) UpdateReleasePR

func (g *GitHub) UpdateReleasePR(ctx context.Context, number int, opts ReleasePROptions) error

type GitLab

type GitLab struct {
	// contains filtered or unexported fields
}

func NewGitLab

func NewGitLab(client *gitlab.Client, project string) *GitLab

NewGitLab creates a provider. pid is the project ID or full path (e.g., "owner/repo").

func (*GitLab) CreateBranch

func (g *GitLab) CreateBranch(ctx context.Context, name, base string) error

func (*GitLab) CreateRelease

func (g *GitLab) CreateRelease(ctx context.Context, opts ReleaseOptions) (*Release, error)

func (*GitLab) CreateReleasePR

func (g *GitLab) CreateReleasePR(ctx context.Context, opts ReleasePROptions) (*PullRequest, error)

func (*GitLab) FindMergedReleasePR

func (g *GitLab) FindMergedReleasePR(ctx context.Context, baseBranch string) (*PullRequest, error)

func (*GitLab) FindOpenPendingReleasePRs

func (g *GitLab) FindOpenPendingReleasePRs(ctx context.Context, baseBranch string) ([]*PullRequest, error)

func (*GitLab) GetCommitsSince

func (g *GitLab) GetCommitsSince(ctx context.Context, ref, branch string, includePaths bool) ([]CommitEntry, error)

func (*GitLab) GetFile

func (g *GitLab) GetFile(ctx context.Context, branch, path string) (string, error)

func (*GitLab) GetLatestVersionRef added in v0.2.2

func (g *GitLab) GetLatestVersionRef(ctx context.Context) (string, error)

func (*GitLab) GetReleaseByTag added in v0.2.2

func (g *GitLab) GetReleaseByTag(ctx context.Context, tag string) (*Release, error)

func (*GitLab) ListTags added in v0.2.2

func (g *GitLab) ListTags(ctx context.Context) ([]string, error)

func (*GitLab) MarkReleasePRPending

func (g *GitLab) MarkReleasePRPending(ctx context.Context, number int) error

func (*GitLab) MarkReleasePRTagged

func (g *GitLab) MarkReleasePRTagged(ctx context.Context, number int) error

func (*GitLab) MergeReleasePR added in v0.1.2

func (g *GitLab) MergeReleasePR(ctx context.Context, number int, opts MergeReleasePROptions) error

func (*GitLab) PathPrefix

func (g *GitLab) PathPrefix() string

func (*GitLab) RepoURL

func (g *GitLab) RepoURL() string

func (*GitLab) TagExists added in v0.2.2

func (g *GitLab) TagExists(ctx context.Context, tag string) (bool, error)

func (*GitLab) UpdateFiles

func (g *GitLab) UpdateFiles(ctx context.Context, branch, base string, files map[string]string, message string) error

func (*GitLab) UpdateReleasePR

func (g *GitLab) UpdateReleasePR(ctx context.Context, number int, opts ReleasePROptions) error

type MergeMethod added in v0.1.2

type MergeMethod = string
const (
	MergeMethodAuto   MergeMethod = "auto"
	MergeMethodSquash MergeMethod = "squash"
	MergeMethodRebase MergeMethod = "rebase"
	MergeMethodMerge  MergeMethod = "merge"
)

type MergeReleasePROptions added in v0.1.2

type MergeReleasePROptions struct {
	Force  bool
	Method MergeMethod
}

type Provider

type Provider interface {
	// contains filtered or unexported methods
}

type PullRequest

type PullRequest struct {
	Number         int
	Title          string
	Body           string
	URL            string
	Branch         string
	MergeCommitSHA string
}

type Release

type Release struct {
	TagName string
	Name    string
	Body    string
	URL     string
}

type ReleaseOptions

type ReleaseOptions struct {
	TagName string
	Ref     string
	Name    string
	Body    string
}

type ReleasePROptions

type ReleasePROptions struct {
	Title         string
	Body          string
	BaseBranch    string
	ReleaseBranch string
	Files         map[string]string
}

type RepoInfo

type RepoInfo struct {
	Owner string
	Name  string
}

type RepositoryDescriptor added in v0.1.3

type RepositoryDescriptor struct {
	Provider string
	Host     string
	Owner    string
	Repo     string
	Project  string
	Remote   string
}

func ParseRemote added in v0.1.3

func ParseRemote(remoteURL string) (*RepositoryDescriptor, error)

Jump to

Keyboard shortcuts

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