Documentation
¶
Index ¶
- func GraphQLPerm2RestAPIPerm(perm string) string
- func SanityCheck(cfg *Config) error
- func SetParentNames(teams map[string]*TeamConfig)
- func SetParents(localCfg *Config)
- func SortConfig(cfg *Config)
- type CodeReviewAssignment
- type Config
- type ExcludedMember
- type OutsideCollaborator
- type Permission
- type Repository
- type RepositoryName
- type TeamConfig
- type TeamOrMemberName
- type TeamPrivacy
- type TeamReviewAssignmentAlgorithm
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GraphQLPerm2RestAPIPerm ¶ added in v1.0.0
func SanityCheck ¶ added in v0.0.2
SanityCheck checks if the all team members belong to the organization.
func SetParentNames ¶ added in v1.0.0
func SetParentNames(teams map[string]*TeamConfig)
func SetParents ¶ added in v1.0.0
func SetParents(localCfg *Config)
func SortConfig ¶
func SortConfig(cfg *Config)
Types ¶
type CodeReviewAssignment ¶
type CodeReviewAssignment struct {
// Algorithm can only be LOAD_BALANCE or ROUND_ROBIN.
Algorithm TeamReviewAssignmentAlgorithm `json:"algorithm,omitempty" yaml:"algorithm,omitempty"`
// Enabled should be set to true if the CRA is enabled.
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
// ExcludedMembers contains the list of members that should not receive
// review requests.
ExcludedMembers []ExcludedMember `json:"excludedMembers,omitempty" yaml:"excludedMembers,omitempty"`
// NotifyTeam will notify the entire team if assigning team members.
NotifyTeam bool `json:"notifyTeam,omitempty" yaml:"notifyTeam,omitempty"`
// TeamMemberCount specifies the number of team members that should be
// assigned to review.
TeamMemberCount int `json:"teamMemberCount,omitempty" yaml:"teamMemberCount,omitempty"`
// IncludeChildTeamMembers to include the members of any child teams when
// assigning requests. Optional.
IncludeChildTeamMembers *bool `json:"includeChildTeamMembers,omitempty" yaml:"includeChildTeamMembers,omitempty"`
}
type Config ¶
type Config struct {
// Organization being managed.
Organization string `json:"organization,omitempty" yaml:"organization,omitempty"`
// URL of the Slack workspace to which the Slack user IDs belong.
SlackWorkspace string `json:"slackWorkspace,omitempty" yaml:"slackWorkspace,omitempty"`
// Repositories contains the list of repositories in the organization and
// its respective team permissions.
Repositories map[RepositoryName]Repository `json:"repositories,omitempty" yaml:"repositories,omitempty"`
// Members maps the github login to a User.
Members map[string]User `json:"members,omitempty" yaml:"members,omitempty"`
// Outside collaborators maps the github login to a User.
Collaborators map[string]OutsideCollaborator `json:"outsideCollaborators,omitempty" yaml:"outsideCollaborators,omitempty"`
// Teams maps the github team name to a TeamConfig.
Teams map[string]*TeamConfig `json:"teams,omitempty" yaml:"teams,omitempty"`
// Slice of github logins that should be excluded from all team reviews
// assignments.
ExcludeCRAFromAllTeams []string `json:"excludeCodeReviewAssignmentFromAllTeams" yaml:"excludeCodeReviewAssignmentFromAllTeams"`
// AllTeams is an index of all teams in the organization
// maps the team name to its config. GitHub doesn't allow duplicated team
// names, so we can do safely do this.
AllTeams map[string]*TeamConfig `json:"-" yaml:"-"`
}
func (*Config) IndexTeams ¶ added in v1.0.0
func (c *Config) IndexTeams()
func (*Config) UpdateTeamIDsFrom ¶ added in v1.0.0
type ExcludedMember ¶
type ExcludedMember struct {
// Login the login of this GH user.
Login string `json:"login" yaml:"login"`
// Reason states the reason why this user is excluded from the
// CodeReviewAssignment.
Reason string `json:"reason" yaml:"reason"`
}
func RemoveExcludedMember ¶ added in v1.0.0
func RemoveExcludedMember(slice []ExcludedMember, elementToRemove string) []ExcludedMember
type OutsideCollaborator ¶ added in v1.0.0
type OutsideCollaborator struct {
// Reason contains the reason why they are an outside collaborator.
Reason string `json:"reason" yaml:"reason"`
}
type Permission ¶ added in v1.0.0
type Permission githubv4.RepositoryPermission
func (Permission) GetPermission ¶ added in v1.0.0
func (p Permission) GetPermission() string
func (Permission) IsUser ¶ added in v1.0.0
func (p Permission) IsUser() bool
func (*Permission) SetUser ¶ added in v1.0.0
func (p *Permission) SetUser()
type Repository ¶ added in v1.0.0
type Repository map[Permission][]TeamOrMemberName
type RepositoryName ¶ added in v1.0.0
type RepositoryName string
type TeamConfig ¶
type TeamConfig struct {
// ID is the GitHub ID of this team.
ID string `json:"id" yaml:"id"`
RESTID int64 `json:"restID" yaml:"restID"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Members is a list of users that belong to this team.
Members []string `json:"members,omitempty" yaml:"members,omitempty"`
// CodeReviewAssignment is the code review assignment configuration of this team
CodeReviewAssignment CodeReviewAssignment `json:"codeReviewAssignment,omitempty" yaml:"codeReviewAssignment,omitempty"`
Privacy TeamPrivacy `json:"privacy,omitempty" yaml:"privacy,omitempty"`
ParentTeam TeamOrMemberName `json:"-" yaml:"-"`
Children map[string]*TeamConfig `json:"children,omitempty" yaml:"children,omitempty"`
}
func (*TeamConfig) Descendents ¶ added in v1.0.0
func (c *TeamConfig) Descendents() []string
func (*TeamConfig) IsAncestorOf ¶ added in v1.0.0
func (c *TeamConfig) IsAncestorOf(child string) bool
type TeamOrMemberName ¶ added in v1.0.0
type TeamOrMemberName string
type TeamPrivacy ¶ added in v1.0.0
type TeamPrivacy githubv4.TeamPrivacy
func ParsePrivacyFromREST ¶ added in v1.0.0
func ParsePrivacyFromREST(restPrivacy string) TeamPrivacy
func (TeamPrivacy) RestPrivacy ¶ added in v1.0.0
func (tp TeamPrivacy) RestPrivacy() *string
type TeamReviewAssignmentAlgorithm ¶
type TeamReviewAssignmentAlgorithm string
const ( TeamReviewAssignmentAlgorithmLoadBalance TeamReviewAssignmentAlgorithm = "LOAD_BALANCE" TeamReviewAssignmentAlgorithmRoundRobin TeamReviewAssignmentAlgorithm = "ROUND_ROBIN" )
type User ¶
type User struct {
// ID is the GitHub ID of this user.
ID string `json:"id" yaml:"id"`
// Name is the real name of the person behind this GH account.
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// SlackID is the Slack user ID of the person behind this GH account.
// The user ID can be found in the UI, under the profile of each user, under "More".
SlackID string `json:"slackID,omitempty" yaml:"slackID,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.