Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) ClosePullRequest(ctx context.Context, owner, repo string, number int) error
- func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, req *CreatePullRequestRequest) (*PullRequest, error)
- func (c *Client) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
- func (c *Client) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (c *Client) GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
- func (c *Client) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (c *Client) GetPullRequestByHead(ctx context.Context, owner, repo, headBranch string) (*PullRequest, error)
- func (c *Client) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
- func (c *Client) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
- func (c *Client) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
- func (c *Client) UpdatePullRequest(ctx context.Context, owner, repo string, number int, ...) (*PullRequest, error)
- type CreatePullRequestRequest
- type CreateReleaseRequest
- type GitHubClient
- type MockClient
- func (m *MockClient) AddBranch(owner, repo, branch string)
- func (m *MockClient) AddPullRequest(owner, repo string, pr *PullRequest)
- func (m *MockClient) AddPullRequestByHead(owner, repo, headBranch string, pr *PullRequest)
- func (m *MockClient) AddPullRequestForCommit(owner, repo, sha string, pr *PullRequest)
- func (m *MockClient) AddRelease(owner, repo string, release *Release)
- func (m *MockClient) ClosePullRequest(ctx context.Context, owner, repo string, number int) error
- func (m *MockClient) CreatePullRequest(ctx context.Context, owner, repo string, req *CreatePullRequestRequest) (*PullRequest, error)
- func (m *MockClient) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
- func (m *MockClient) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (m *MockClient) GetAllPullRequests(owner, repo string) []*PullRequest
- func (m *MockClient) GetAllReleases(owner, repo string) []*Release
- func (m *MockClient) GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
- func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
- func (m *MockClient) GetPullRequestByHead(ctx context.Context, owner, repo, headBranch string) (*PullRequest, error)
- func (m *MockClient) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
- func (m *MockClient) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
- func (m *MockClient) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
- func (m *MockClient) Reset()
- func (m *MockClient) SetupRepository(owner, repo string)
- func (m *MockClient) UpdatePullRequest(ctx context.Context, owner, repo string, number int, ...) (*PullRequest, error)
- type PREnricher
- type PREnrichmentResult
- type PRMapping
- type PRRenderer
- type PullRequest
- type PullRequestInfo
- type RelatedPRInfo
- type Release
- type Repository
- type TemplateData
- type UpdatePullRequestRequest
Constants ¶
const DefaultTitleTemplate = "🚀 Release {{.Project}} v{{.Version}}"
Variables ¶
var (
ErrGitHubTokenNotFound = fmt.Errorf("GITHUB_TOKEN or GH_TOKEN environment variable not found")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements GitHubClient using the real GitHub API
func NewClientFromEnv ¶ added in v0.0.5
NewClientFromEnv creates a GitHub client using the token from environment variables
func NewClientWithoutAuth ¶
func NewClientWithoutAuth() *Client
NewClientWithoutAuth creates a GitHub client without authentication (for public operations)
func (*Client) ClosePullRequest ¶ added in v0.0.5
func (*Client) CreatePullRequest ¶ added in v0.0.5
func (c *Client) CreatePullRequest(ctx context.Context, owner, repo string, req *CreatePullRequestRequest) (*PullRequest, error)
func (*Client) CreateRelease ¶
func (*Client) DeleteBranch ¶ added in v0.0.5
func (*Client) GetLatestRelease ¶
func (*Client) GetPullRequest ¶
func (*Client) GetPullRequestByHead ¶ added in v0.0.5
func (*Client) GetReleaseByTag ¶
func (*Client) GetRepository ¶
func (*Client) ListPullRequestsByCommit ¶
func (*Client) UpdatePullRequest ¶ added in v0.0.5
func (c *Client) UpdatePullRequest(ctx context.Context, owner, repo string, number int, req *UpdatePullRequestRequest) (*PullRequest, error)
type CreatePullRequestRequest ¶ added in v0.0.5
type CreatePullRequestRequest struct {
Title string
Body string
Head string
Base string
Draft bool
}
CreatePullRequestRequest represents a request to create a pull request
type CreateReleaseRequest ¶
type CreateReleaseRequest struct {
TagName string
Name string
Body string
Draft bool
Prerelease bool
TargetCommitish string
}
CreateReleaseRequest represents a request to create a release
type GitHubClient ¶
type GitHubClient interface {
// Release operations
GetLatestRelease(ctx context.Context, owner, repo string) (*Release, error)
GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
CreateRelease(ctx context.Context, owner, repo string, release *CreateReleaseRequest) (*Release, error)
// Repository operations
GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
// Pull request operations
GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
GetPullRequestByHead(ctx context.Context, owner, repo, headBranch string) (*PullRequest, error)
ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
CreatePullRequest(ctx context.Context, owner, repo string, req *CreatePullRequestRequest) (*PullRequest, error)
UpdatePullRequest(ctx context.Context, owner, repo string, number int, req *UpdatePullRequestRequest) (*PullRequest, error)
ClosePullRequest(ctx context.Context, owner, repo string, number int) error
DeleteBranch(ctx context.Context, owner, repo, branch string) error
}
GitHubClient provides an abstraction over GitHub API operations
type MockClient ¶
type MockClient struct {
// Hooks for testing error scenarios
GetLatestReleaseError error
GetReleaseByTagError error
CreateReleaseError error
GetRepositoryError error
GetPullRequestError error
GetPullRequestByHeadError error
ListPullRequestsByCommitError error
CreatePullRequestError error
UpdatePullRequestError error
ClosePullRequestError error
DeleteBranchError error
// contains filtered or unexported fields
}
MockClient implements GitHubClient for testing
func (*MockClient) AddBranch ¶ added in v0.0.5
func (m *MockClient) AddBranch(owner, repo, branch string)
AddBranch adds a branch to the mock
func (*MockClient) AddPullRequest ¶
func (m *MockClient) AddPullRequest(owner, repo string, pr *PullRequest)
AddPullRequest adds a pull request to the mock
func (*MockClient) AddPullRequestByHead ¶ added in v0.0.5
func (m *MockClient) AddPullRequestByHead(owner, repo, headBranch string, pr *PullRequest)
AddPullRequestByHead adds a PR and indexes it by head branch
func (*MockClient) AddPullRequestForCommit ¶
func (m *MockClient) AddPullRequestForCommit(owner, repo, sha string, pr *PullRequest)
AddPullRequestForCommit associates a pull request with a commit SHA
func (*MockClient) AddRelease ¶
func (m *MockClient) AddRelease(owner, repo string, release *Release)
AddRelease adds a release to the mock
func (*MockClient) ClosePullRequest ¶ added in v0.0.5
func (*MockClient) CreatePullRequest ¶ added in v0.0.5
func (m *MockClient) CreatePullRequest(ctx context.Context, owner, repo string, req *CreatePullRequestRequest) (*PullRequest, error)
func (*MockClient) CreateRelease ¶
func (m *MockClient) CreateRelease(ctx context.Context, owner, repo string, req *CreateReleaseRequest) (*Release, error)
func (*MockClient) DeleteBranch ¶ added in v0.0.5
func (m *MockClient) DeleteBranch(ctx context.Context, owner, repo, branch string) error
func (*MockClient) GetAllPullRequests ¶ added in v0.0.5
func (m *MockClient) GetAllPullRequests(owner, repo string) []*PullRequest
GetAllPullRequests returns all pull requests for a repository (helper for testing)
func (*MockClient) GetAllReleases ¶
func (m *MockClient) GetAllReleases(owner, repo string) []*Release
GetAllReleases returns all releases for a repository (helper for testing)
func (*MockClient) GetLatestRelease ¶
func (*MockClient) GetPullRequest ¶
func (m *MockClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*PullRequest, error)
func (*MockClient) GetPullRequestByHead ¶ added in v0.0.5
func (m *MockClient) GetPullRequestByHead(ctx context.Context, owner, repo, headBranch string) (*PullRequest, error)
func (*MockClient) GetReleaseByTag ¶
func (*MockClient) GetRepository ¶
func (m *MockClient) GetRepository(ctx context.Context, owner, repo string) (*Repository, error)
func (*MockClient) ListPullRequestsByCommit ¶
func (m *MockClient) ListPullRequestsByCommit(ctx context.Context, owner, repo, sha string) ([]*PullRequest, error)
func (*MockClient) Reset ¶
func (m *MockClient) Reset()
Reset clears all data from the mock (helper for testing)
func (*MockClient) SetupRepository ¶
func (m *MockClient) SetupRepository(owner, repo string)
SetupRepository adds a repository to the mock
func (*MockClient) UpdatePullRequest ¶ added in v0.0.5
func (m *MockClient) UpdatePullRequest(ctx context.Context, owner, repo string, number int, req *UpdatePullRequestRequest) (*PullRequest, error)
type PREnricher ¶ added in v0.0.5
type PREnricher struct {
// contains filtered or unexported fields
}
func NewPREnricher ¶ added in v0.0.5
func NewPREnricher(gitClient git.GitClient, ghClient GitHubClient) *PREnricher
func (*PREnricher) Enrich ¶ added in v0.0.5
func (e *PREnricher) Enrich(ctx context.Context, changesets []*models.Changeset, owner, repo string) (PREnrichmentResult, error)
type PREnrichmentResult ¶ added in v0.0.5
type PRMapping ¶ added in v0.0.5
type PRMapping struct {
Version int `json:"version"`
UpdatedAt string `json:"updatedAt"`
Projects map[string]PullRequestInfo `json:"projects"`
}
func NewPRMapping ¶ added in v0.0.5
func NewPRMapping() *PRMapping
func ReadPRMapping ¶ added in v0.0.5
func (*PRMapping) Get ¶ added in v0.0.5
func (m *PRMapping) Get(project string) (PullRequestInfo, bool)
func (*PRMapping) Set ¶ added in v0.0.5
func (m *PRMapping) Set(project string, entry PullRequestInfo)
type PRRenderer ¶ added in v0.0.5
type PRRenderer struct {
// contains filtered or unexported fields
}
func NewPRRenderer ¶ added in v0.0.5
func NewPRRenderer(fs filesystem.FileSystem) *PRRenderer
func (*PRRenderer) RenderBody ¶ added in v0.0.5
func (p *PRRenderer) RenderBody(data TemplateData, projectRoot string) (string, error)
func (*PRRenderer) RenderTitle ¶ added in v0.0.5
func (p *PRRenderer) RenderTitle(data TemplateData, projectRoot string) (string, error)
type PullRequest ¶
type PullRequest struct {
Number int
Title string
Body string
HTMLURL string
Author string
State string
Merged bool
MergeCommitSHA string
Head string
Base string
Labels []string
}
PullRequest represents a GitHub pull request
type PullRequestInfo ¶ added in v0.0.5
type PullRequestInfo struct {
PullRequest `json:",inline"`
Version string `json:"version"`
Project string `json:"project"`
}
type RelatedPRInfo ¶ added in v0.0.5
type Release ¶
type Release struct {
ID int64
TagName string
Name string
Body string
Draft bool
Prerelease bool
CreatedAt time.Time
PublishedAt time.Time
}
Release represents a GitHub release
type Repository ¶
Repository represents a GitHub repository
type TemplateData ¶ added in v0.0.5
type TemplateData struct {
Project string
Version string
// CurrentVersion string
ChangelogPreview string
RelatedPRs []RelatedPRInfo
}
type UpdatePullRequestRequest ¶ added in v0.0.5
UpdatePullRequestRequest represents a request to update a pull request