Help us shape the future of Go! Take the 2026 Go Developer Survey

secretaccess

package
v0.24.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package secretaccess holds the helpers shared by the ActionsSecretAccess and DependabotSecretAccess controllers.

Index

Constants

View Source
const VisibilitySelected = "selected"

VisibilitySelected is the visibility under which a secret has a repository list.

Variables

This section is empty.

Functions

func ListRepoIDs

func ListRepoIDs(ctx context.Context, l RepoLister, org, name string) (map[string]int64, error)

ListRepoIDs returns the ID of every repository that can use the secret on GitHub, keyed by lowercased name: GitHub repository names are case-insensitive, so callers must look names up lowercased.

func ListRepoNames

func ListRepoNames(ctx context.Context, l RepoLister, org, name string) ([]string, error)

ListRepoNames returns the names of all repositories that can use the secret on GitHub, spelled as GitHub reports them.

func RenamedRepoError

func RenamedRepoError(known map[string]int64, added []string, addedIDs []int64) error

RenamedRepoError returns an error if a declared name absent from the list (added) resolved to an ID the list (known, from ListRepoIDs) already holds under another name. That repository was renamed on GitHub and the spec still uses the old name: writing would change nothing and repeat every poll, so fail loud instead. addedIDs are the IDs of added, in the same order.

func RepoNames

func RepoNames(refs []v1alpha1.SecretSelectedRepo) []string

RepoNames returns the distinct repository names declared in spec, in spec order, keeping the first spelling of names that differ only in case. The declared list is a set: a duplicate must not read as drift or be sent to GitHub twice, or the provider rewrites the list every poll.

func RepoObservations

func RepoObservations(names []string) []v1alpha1.SecretSelectedRepoObservation

RepoObservations returns names as observed repositories, sorted.

func SameRepos

func SameRepos(spec []v1alpha1.SecretSelectedRepo, ghNames []string) bool

SameRepos reports whether the spec and GitHub list the same repositories, in any order and ignoring case. GitHub repository names are case-insensitive, so a case difference must not read as drift or Update rewrites the list every poll.

func SecretNotFound

func SecretNotFound(name string) xpv2.Condition

SecretNotFound is the Ready condition for a secret missing on GitHub.

func SecretNotFoundError

func SecretNotFoundError(name string) error

SecretNotFoundError is the Create error: the secret must exist on GitHub first.

func VisibilityMismatch

func VisibilityMismatch(ghVisibility, specVisibility string) xpv2.Condition

VisibilityMismatch is the Ready condition for a visibility the provider cannot change.

Types

type RepoLister

type RepoLister interface {
	ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *github.ListOptions) (*github.SelectedReposList, *github.Response, error)
}

RepoLister lists the repositories that can use an organization secret.

Jump to

Keyboard shortcuts

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