Documentation ¶
Index ¶
Constants ¶
View Source
const ( // KindRepo - repository model kind KindRepo = Kind("Repository") // KindReadme - repository readme model kind KindReadme = Kind("Readme") // KindOrg - organization model kind KindOrg = Kind("Organization") // KindHook - repository webhook KindHook = Kind("WebHook") // KindTeam - organization team KindTeam = Kind("Team") // KindProtection - repository branch protection rule KindProtection = Kind("Protection") )
View Source
const ( FeatureIssues = "issues" FeatureWiki = "wiki" FeaturePages = "pages" FeatureProjects = "projects" FeatureDownloads = "downloads" )
View Source
const ( RepoVisibilityPublic = "public" RepoVisibilityPrivate = "private" )
View Source
const ( MergeCommit = "commit" MergeRebase = "rebase" MergeSquash = "squash" )
View Source
const (
// Version of spec
Version = "v2"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrInvalidKind ¶
type ErrInvalidKind struct {
// Expected and Actual values of kind
Expected, Actual Kind
}
ErrInvalidKind - error that kind is not the value as expected
func (*ErrInvalidKind) Error ¶
func (e *ErrInvalidKind) Error() string
func (*ErrInvalidKind) RecoverHandler ¶
func (e *ErrInvalidKind) RecoverHandler(out *error)
RecoverHandler could be used to catch this error on panic with defer
type Hook ¶
type Hook struct { URL string `yaml:"url" default:"http://example.com/hook"` ContentType string `yaml:"contentType" default:"json"` InsecureSsl bool `yaml:"insecureSsl,omitempty" default:"false"` Secret string `yaml:"secret,omitempty"` Events []string `yaml:"events,omitempty" default:"[\"push\"]"` Active bool `yaml:"active" default:"true"` Selector struct { Repository string `yaml:"repository,omitempty"` Organization string `yaml:"organization,omitempty"` } `yaml:"selector"` }
type Metadata ¶
type Metadata struct { Name string `yaml:"name,omitempty"` Repo string `yaml:"repo,omitempty"` Owner string `yaml:"owner,omitempty"` ID *int64 `yaml:"id,omitempty"` Annotations map[string]string `yaml:"annotations,omitempty"` }
Metadata for spec
func (*Metadata) FromGithubOrg ¶
func (m *Metadata) FromGithubOrg(o *github.Organization)
func (*Metadata) FromGithubRepo ¶
func (m *Metadata) FromGithubRepo(r *github.Repository)
func (*Metadata) FromGithubTeam ¶
type Model ¶
type Model struct { Version string `yaml:"version"` Kind Kind `yaml:"kind"` Metadata *Metadata `yaml:"metadata,omitempty"` Spec interface{} `yaml:"-"` }
Model of spec
func (*Model) FromDecoder ¶
FromDecoder creates model from yaml decoder
func (*Model) FromReader ¶
FromReader creates model from io reader
func (*Model) MarshalYAML ¶
func (*Model) UnmarshalYAML ¶
type Org ¶
type Org struct { Name string `yaml:"name"` Description string `yaml:"description,omitempty"` Company string `yaml:"company,omitempty"` Blog string `yaml:"blog,omitempty"` Location string `yaml:"location,omitempty"` Email string `yaml:"email,omitempty"` Twitter string `yaml:"twitter,omitempty"` Verified bool `yaml:"verified,omitempty"` }
func (*Org) FromGithub ¶
func (o *Org) FromGithub(g *github.Organization)
type Protection ¶
type Protection struct { // Checks represents required status checks for merge Checks []string `yaml:"checks,omitempty"` // Strict update with target branch is requried Strict bool `yaml:"strictUpdate,omitempty"` // Review represents pull request review enforcement Review struct { // Require pull request reviews enforcement of a protected branch. Require bool `yaml:"require,omitempty"` // Dismiss pull request review Dismiss struct { // Users who can dismiss review Users []string `yaml:"users,omitempty"` // Teams who can dismiss review Teams []string `yaml:"teams,omitempty"` // Automatically dismiss approving reviews when someone pushes a new commit. Stale bool `yaml:"stale,omitempty"` } `yaml:"dismiss,omitempty"` // RequireOwner blocks merging pull requests until code owners review them. RequireOwner bool `yaml:"requireOwner,omitempty"` // Count is the number of reviewers required to approve pull requests. Count int `yaml:"count,omitempty"` } `yaml:"review,omitempty"` // EnforceAdmins the same rules EnforceAdmins bool `yaml:"enforceAdmins,omitempty"` // LinearHistory is required for merging branch LinearHistory bool `yaml:"linearHistory,omitempty"` // ForcePush is allowed ForcePush bool `yaml:"forcePush,omitempty"` // CanDelete target branch CanDelete bool `yaml:"canDelete,omitempty"` // Permissions Permissions struct { // Restrict permissions is enabled Restrict bool `yaml:"restrict,omitempty"` // Users with push access Users []string `yaml:"users,omitempty"` // Teams with push access Teams []string `yaml:"teams,omitempty"` // Apps with push access Apps []string `yaml:"apps,omitempty"` } `yaml:"permissions,omitempty"` // ConversationResolution, if set to true, requires all comments // on the pull request to be resolved before it can be merged to a protected branch. ConversationResolution bool `yaml:"conversationResolution,omitempty"` }
Protection rule of repositry branch
func (*Protection) FromGithub ¶
func (bp *Protection) FromGithub(g *github.Protection) error
func (*Protection) ToGithub ¶
func (bp *Protection) ToGithub(pr *github.ProtectionRequest) error
type Readme ¶
type Repo ¶
type Repo struct { Description *string `yaml:"description,omitempty"` Homepage *string `yaml:"homepage,omitempty"` DefaultBranch string `yaml:"defaultBranch,omitempty" default:"master"` MergeStrategy []string `yaml:"mergeStrategy,omitempty" default:"[\"merge\"]"` DeleteBranchOnMerge *bool `yaml:"deleteBranchOnMerge,omitempty"` Topics []string `yaml:"topics,omitempty"` Archived *bool `yaml:"archived,omitempty"` Disabled *bool `yaml:"disabled,omitempty"` License *string `yaml:"license,omitempty"` Visibiliy *string `yaml:"visibility,omitempty" default:"public"` Features []string `yaml:"features,omitempty"` }
Repo spec
func (*Repo) FromGithub ¶
func (spec *Repo) FromGithub(repo *github.Repository)
Click to show internal directories.
Click to hide internal directories.