files

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

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).

Types

type CodeOwners

type CodeOwners struct {
	PathList   []string
	IgnoreList []string

	Groups map[string][]string
	Paths  map[string][]string
	Users  map[string]bool
}

Jump to

Keyboard shortcuts

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