Documentation
¶
Index ¶
- Variables
- type GithubRepo
- func (c *GithubRepo) AddBranchProtections(ctx context.Context, repo string, org string, ...) error
- func (c *GithubRepo) AddCollaborators(ctx context.Context, repo string, org string, ...) error
- func (c *GithubRepo) AddLabelsToRepo(ctx context.Context, repo string, org string, opts *LabelsOpts) error
- func (c *GithubRepo) AddPullApprove(ctx context.Context, repo string, org string, opts *PullApproveOpts) error
- func (c *GithubRepo) AddTeamsToRepo(ctx context.Context, repo string, org string, teams []*config.Team) error
- func (c *GithubRepo) AddWebhooksToRepo(ctx context.Context, repo string, org string, webhooks []*config.Webhook) error
- func (c *GithubRepo) CreateRepo(ctx context.Context, org string, repoOpts *github.Repository) (*github.Repository, error)
- type GithubRepoOpts
- type LabelsOpts
- type PullApproveOpts
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRepositoryAlreadyExists is used when the repository already exists ErrRepositoryAlreadyExists = errors.New("github repository already exists") // ErrRepositoryLimitExceeded is used when the repository limit is exceeded ErrRepositoryLimitExceeded = errors.New("limit for private repos on this account is exceeded") // ErrPullApproveFileAlreadyExists is used when the pull approve file already exists ErrPullApproveFileAlreadyExists = errors.New("github pull approve file already exists") // ErrLabelNotFound is used when a label is not found ErrLabelNotFound = errors.New("github label does not exist") // ErrLabeAlreadyExists is used when a label is not found ErrLabeAlreadyExists = errors.New("github label already exists") // ErrWebhookAlreadyExist is used when a webhook already exists ErrWebhookAlreadyExist = errors.New("github webhook already exists") // ErrOrganizationNotFound is used when a webhook already exists ErrOrganizationNotFound = errors.New("you must specify an organization to use this functionality") // ErrPullApproveClientNotSet is used when the PA client is nil ErrPullApproveClientNotSet = errors.New("Cannot add pull approve, since the client is nil") )
Functions ¶
This section is empty.
Types ¶
type GithubRepo ¶
GithubRepo contains all the hellofresh repository creation Opts for github
func NewGithub ¶
func NewGithub(githubClient *github.Client) *GithubRepo
NewGithub creates a new instance of Client
func (*GithubRepo) AddBranchProtections ¶
func (c *GithubRepo) AddBranchProtections(ctx context.Context, repo string, org string, protections config.BranchProtections) error
AddBranchProtections adds an slice of branch protections to the repository
func (*GithubRepo) AddCollaborators ¶
func (c *GithubRepo) AddCollaborators(ctx context.Context, repo string, org string, collaborators []*config.Collaborator) error
AddCollaborators adds an slice of collaborators and their permissions to the repository
func (*GithubRepo) AddLabelsToRepo ¶
func (c *GithubRepo) AddLabelsToRepo(ctx context.Context, repo string, org string, opts *LabelsOpts) error
AddLabelsToRepo adds an slice of labels to the repository. Optionally this can also remove github's default labels
func (*GithubRepo) AddPullApprove ¶
func (c *GithubRepo) AddPullApprove(ctx context.Context, repo string, org string, opts *PullApproveOpts) error
AddPullApprove adds a file to the github repository and calls pull approve API to register the new repo
func (*GithubRepo) AddTeamsToRepo ¶
func (c *GithubRepo) AddTeamsToRepo(ctx context.Context, repo string, org string, teams []*config.Team) error
AddTeamsToRepo adds an slice of teams and their permissions to a repository
func (*GithubRepo) AddWebhooksToRepo ¶
func (c *GithubRepo) AddWebhooksToRepo(ctx context.Context, repo string, org string, webhooks []*config.Webhook) error
AddWebhooksToRepo adds an slice of webhooks to the repository
func (*GithubRepo) CreateRepo ¶
func (c *GithubRepo) CreateRepo(ctx context.Context, org string, repoOpts *github.Repository) (*github.Repository, error)
CreateRepo creates a github repository
type GithubRepoOpts ¶
type GithubRepoOpts struct {
PullApprove *PullApproveOpts
Teams []*config.Team
Collaborators []*config.Collaborator
Labels *LabelsOpts
Webhooks []*config.Webhook
BranchProtections config.BranchProtections
}
GithubRepoOpts represents the repo creation options
type LabelsOpts ¶
LabelsOpts represents label options
type PullApproveOpts ¶
type PullApproveOpts struct {
Client *pullapprove.Client
Filename string
ProtectedBranchName string
}
PullApproveOpts represents pull approve options