Documentation
¶
Overview ¶
Package files checks if a reviewer is a code owner of any files in a PR, and if a PR touches high-risk files.
This functionality is based on comparing the PR's diffstat against the "CODEOWNERS" and "highrisk.txt" files in the PR's destination branch.
This is used in Slack: daily reminders, the status slash command, and ready-to-merge notifications.
Index ¶
- func CountHighRiskFiles(ctx workflow.Context, workspace, repo, branch, commit string, paths []string) int
- func CountOwnedFiles(ctx workflow.Context, workspace, repo, branch, commit, userName string, ...) int
- func GotAllRequiredApprovals(ctx workflow.Context, workspace, repo, branch, commit string, ...) bool
- func OwnersPerPath(ctx workflow.Context, workspace, repo, branch, commit string, paths []string, ...) (owners, groups map[string][]string)
- type CodeOwners
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountHighRiskFiles ¶
func CountHighRiskFiles(ctx workflow.Context, workspace, repo, branch, commit string, paths []string) int
CountHighRiskFiles counts how many of the given file paths are considered high risk, according to the "highrisk.txt" file in the given branch (a PR's destination).
func CountOwnedFiles ¶
func CountOwnedFiles(ctx workflow.Context, workspace, repo, branch, commit, userName string, paths []string) int
CountOwnedFiles counts how many of the given file paths are owned by the given user, according to the "CODEOWNERS" file in the given branch (a PR's destination).
func GotAllRequiredApprovals ¶
func GotAllRequiredApprovals(ctx workflow.Context, workspace, repo, branch, commit string, paths, approvers []string) bool
GotAllRequiredApprovals checks whether all required approvals are present for the given file paths, according to the "CODEOWNERS" file in the given branch (a PR's destination).
func OwnersPerPath ¶ added in v1.0.0
func OwnersPerPath(ctx workflow.Context, workspace, repo, branch, commit string, paths []string, flatten bool) (owners, groups map[string][]string)
OwnersPerPath retrieves the list of code owners for each of the given file paths, according to the "CODEOWNERS" file in the given branch (a PR's destination).