scm

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package scm provides source control management abstractions and provider interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, factory ProviderFactory)

Register a new SCM provider factory by name.

Types

type Provider

type Provider interface {
	// ListRepositories lists all repositories in the specified project.
	ListRepositories() ([]*Repository, error)

	// GetPullRequest retrieves a pull request by repository name and source branch.
	GetPullRequest(repo, branch string) (*PullRequest, error)
	// OpenPullRequest opens a new pull request in the specified repository.
	OpenPullRequest(repo, branch, title, description string, reviewers []string) (*PullRequest, error)
	// UpdatePullRequest updates an existing pull request.
	UpdatePullRequest(repo, branch, title, description string, reviewers []string, appendReviewers bool) (*PullRequest, error)
	// MergePullRequest merges an existing pull request.
	MergePullRequest(repo, branch string, force bool) (*PullRequest, error)
}

Provider defines the interface for SCM providers.

func Get

func Get(ctx context.Context, name, project string) Provider

Get retrieves a registered SCM provider by name. If the provider is not registered, it panics.

type ProviderFactory

type ProviderFactory func(ctx context.Context, project string) Provider

ProviderFactory is a function that creates a new Provider instance.

type PullRequest

type PullRequest struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Branch      string   `json:"branch"`
	Repo        string   `json:"repo"`
	Reviewers   []string `json:"reviewers"`
	Mergeable   bool     `json:"mergeable"`

	ID      int `json:"id"`
	Number  int `json:"number"`
	Version int `json:"version,omitempty"`
}

PullRequest represents a pull request in a repository.

type Repository

type Repository struct {
	Name          string   `json:"name"`
	Description   string   `json:"description"`
	Public        bool     `json:"public"`
	Project       string   `json:"project"`
	DefaultBranch string   `json:"default_branch"`
	Labels        []string `json:"labels,omitempty"`
}

Repository represents a source code repository.

Directories

Path Synopsis
Package bitbucket provides Bitbucket SCM integration for batch-tool.
Package bitbucket provides Bitbucket SCM integration for batch-tool.
Package github provides GitHub SCM integration for batch-tool.
Package github provides GitHub SCM integration for batch-tool.

Jump to

Keyboard shortcuts

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