repo

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2019 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

type GithubRepo struct {
	GithubClient *github.Client
}

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

type LabelsOpts struct {
	RemoveDefaultLabels bool
	Labels              []*config.Label
}

LabelsOpts represents label options

type PullApproveOpts

type PullApproveOpts struct {
	Client              *pullapprove.Client
	Filename            string
	ProtectedBranchName string
}

PullApproveOpts represents pull approve options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL