Documentation
¶
Index ¶
- type GitHubProvider
- type GitLabProvider
- type PROptions
- type PRProvider
- type Repo
- func (r *Repo) AddAll() error
- func (r *Repo) Commit(message, author, email string) error
- func (r *Repo) CreateBranch(name string) error
- func (r *Repo) CurrentBranch() (string, error)
- func (r *Repo) Dir() string
- func (r *Repo) Push(ctx context.Context, token string) error
- func (r *Repo) RemoteURL() (string, error)
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubProvider ¶
GitHubProvider implements PRProvider using the GitHub API.
type GitLabProvider ¶
GitLabProvider implements PRProvider using the GitLab API.
type PROptions ¶
type PROptions struct {
RepoURL string
Title string
Body string
HeadBranch string
BaseBranch string
Labels []string
WorkDir string // repo working directory, used by CLI fallback
}
PROptions holds the parameters for creating a PR.
type PRProvider ¶
PRProvider is the interface for creating pull requests / merge requests.
func NewProvider ¶
func NewProvider(provider, tokenEnv string, logger *slog.Logger) (PRProvider, error)
NewProvider returns a PRProvider for the given provider name. It checks for the API token first; if the token is missing but the corresponding CLI binary (gh / glab) is available, it returns a CLI-only provider instead of an error.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo implements Repository using go-git with CLI fallback.
func (*Repo) CreateBranch ¶
func (*Repo) CurrentBranch ¶
type Repository ¶
type Repository interface {
Dir() string
CreateBranch(name string) error
AddAll() error
Commit(message, author, email string) error
Push(ctx context.Context, token string) error
CurrentBranch() (string, error)
RemoteURL() (string, error)
}
Repository is the interface for git operations. All methods try the go-git library first and fall back to the git CLI.