Documentation
¶
Overview ¶
Package github provides utilities for interacting with the GitHub API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitHub API client and implements PRCreator.
type ClientOption ¶ added in v1.1.0
type ClientOption func(*Client)
ClientOption is a functional option for configuring the Client.
func WithFileReader ¶ added in v1.1.0
func WithFileReader(fr FileReader) ClientOption
WithFileReader sets a custom FileReader implementation for the Client. This is useful for testing or when file reading needs to be customized.
type FileReader ¶ added in v1.1.0
type FileReader interface {
// ReadFile reads the contents of a file at the given path.
// It returns the file contents as a byte slice, or an error if the read fails.
ReadFile(path string) ([]byte, error)
}
FileReader defines the interface for reading file contents. This abstraction allows for dependency injection and makes the client testable by enabling mock file systems.
type PRCreator ¶ added in v1.1.0
type PRCreator interface {
// CreateReleasePR creates a new branch with the modified files and opens a PR.
CreateReleasePR(ctx context.Context, req PRRequest) (*PRResult, error)
}
PRCreator defines the interface for creating pull requests.
type PRRequest ¶
type PRRequest struct {
Owner string // GitHub repository owner (required)
Repo string // GitHub repository name (required)
BaseBranch string // Base branch for the PR (required, e.g., "main")
HeadBranch string // Feature branch to create (required)
Title string // PR title (required)
Body string // PR body/description
Files []string // Files to commit (required, must not be empty)
}
PRRequest contains the parameters for creating a pull request. All fields except Body are required.