Documentation
¶
Overview ¶
Package pr provides pull request creation functionality
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePRBody ¶
func GeneratePRBody(result types.VulnFixResults) string
GeneratePRBody generates the body/description for the pull request
Types ¶
type GitHubPRCreator ¶
type GitHubPRCreator struct {
// contains filtered or unexported fields
}
GitHubPRCreator implements PRCreator interface for GitHub using the GitHub SDK
func NewGitHubPRCreator ¶
func NewGitHubPRCreator(baseURL, token string, workingDir string) *GitHubPRCreator
NewGitHubPRCreator creates a new GitHub PR creator
func (*GitHubPRCreator) CreatePR ¶
func (g *GitHubPRCreator) CreatePR(repo *config.RepoConfig, sourceBranch string, option PRCreateOption) (types.PRInfo, error)
CreatePR creates a pull request based on the update result If PR already exists, it will update the existing PR instead of creating a new one
func (*GitHubPRCreator) GetPlatformType ¶
func (g *GitHubPRCreator) GetPlatformType() string
GetPlatformType returns the type of platform
type GitLabPRCreator ¶
type GitLabPRCreator struct {
// contains filtered or unexported fields
}
GitLabPRCreator implements PRCreator interface for GitLab
func NewGitLabPRCreator ¶
func NewGitLabPRCreator(baseURL, token string, workingDir string) (*GitLabPRCreator, error)
NewGitLabPRCreator creates a new GitLab PR (Merge Request) creator
func (*GitLabPRCreator) CreatePR ¶
func (g *GitLabPRCreator) CreatePR(repo *config.RepoConfig, sourceBranch string, option PRCreateOption) (types.PRInfo, error)
CreatePR creates a merge request based on the update result
func (*GitLabPRCreator) GetPlatformType ¶
func (g *GitLabPRCreator) GetPlatformType() string
GetPlatformType returns the type of platform
type PRCreateOption ¶
type PRCreateOption struct {
Labels []string `json:"labels" yaml:"labels"`
Assignees []string `json:"assignees" yaml:"assignees"`
UpdateSummary types.VulnFixResults `json:"update_summary" yaml:"update_summary"`
}
type PRCreator ¶
type PRCreator interface {
// CreatePR creates a pull request based on the update result
CreatePR(repo *config.RepoConfig, sourceBranch string, option PRCreateOption) (types.PRInfo, error)
// GetPlatformType returns the type of platform (github, gitlab, etc.)
GetPlatformType() string
}
PRCreator defines the interface for creating pull requests
func NewPRCreator ¶
func NewPRCreator(provider config.GitProviderConfig, workingDir string) (PRCreator, error)
NewPRCreator creates a new PRCreator based on the git provider configuration