plan

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package plan turns a config model into a flat list of intended actions per (target, kind, name).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EffectiveIgnored

func EffectiveIgnored(allRepos, perRepo *config.Repo) config.Ignored

EffectiveIgnored returns the cascaded ignored list at a single repo.

Useful for downstream code (diff) that needs an ignored set for marking extras. A name is effectively ignored when it ends up in an ActionIgnored intent under ForRepoCascade.

func EffectiveOrgIgnored

func EffectiveOrgIgnored(s *config.OrgScope) config.Ignored

EffectiveOrgIgnored returns the org-level ignored list (no cascade).

Useful for downstream code that needs an ignored set for marking extras at the org scope. Unlike repo-scope ignored, there is no cascade across scope classes; org.ignored applies only to the org-level GitHub object.

func IsIgnored

func IsIgnored(r *config.Repo, kind Kind, name string) bool

IsIgnored reports whether name appears in the repo's ignored list for kind.

Types

type Action

type Action string

Action describes what the runner intends to do with the entry.

const (
	// ActionManaged means the entry is in the managed block — apply/audit
	// against it.
	ActionManaged Action = "managed"
	// ActionIgnored means the name appears in the ignored block at this
	// scope — skip it for both apply and audit-output.
	ActionIgnored Action = "ignored"
)

type Intent

type Intent struct {
	Repo   string
	Kind   Kind
	Name   string
	Action Action
	Entry  *config.Entry

	// OverridesAllRepos is true when this intent's name was also present in
	// all-repos.managed and the per-repo entry took precedence. Reserved for
	// audit-side override reporting; runtime behavior is unaffected.
	OverridesAllRepos bool

	// ShieldsAllReposManaged is true when this is an ActionIgnored intent
	// produced by per-repo.ignored shielding an all-repos.managed entry.
	// Reserved for audit-side override reporting; runtime behavior is
	// unaffected.
	ShieldsAllReposManaged bool

	// IsOrg distinguishes an org-level intent (different GitHub object class)
	// from a repo-level intent. When true, Repo is empty and the entry is
	// targeted at the named organization.
	IsOrg bool

	// Visibility is the org-level secret/variable visibility envelope and is
	// only meaningful when IsOrg is true. One of "all", "private", "selected".
	Visibility string

	// SelectedRepos is the static list of repo names that may access the
	// entry; only populated when IsOrg && Visibility == "selected".
	SelectedRepos []string
}

Intent is one (target, kind, name) action with its source entry.

func ForOrg

func ForOrg(s *config.OrgScope) []Intent

ForOrg returns intents for an org-level scope.

Org intents are a different GitHub object class than repo intents (org secrets/vars/dependabot live on the organization, not on a repo) and are therefore returned with IsOrg=true and Repo="". The cascade rules between per-repo / all-repos / org operate on repo-level objects only — org-scope intents do not collide with repo-scope intents.

Output order is stable: section order vars, secrets, dependabot; within each section, managed names sorted, then ignored names sorted.

func ForRepo

func ForRepo(repo string, r *config.Repo) []Intent

ForRepo returns intents for every managed entry on the repo plus a skip-intent for every name in the ignored block.

Output order is stable: section order vars, secrets, dependabot; within each section, managed names sorted, then ignored names sorted.

func ForRepoCascade

func ForRepoCascade(repoName string, allRepos, perRepo *config.Repo) []Intent

ForRepoCascade returns intents for one repo after applying the per-repo > all-repos precedence rules.

Rules (per kind, per name):

  • In per-repo.managed → managed (per-repo entry). Marked OverridesAllRepos when the same name was also in all-repos.managed.
  • In per-repo.ignored → ignored.
  • In all-repos.managed (and not above) → managed (all-repos entry).
  • In all-repos.ignored (and not above) → ignored.

type Kind

type Kind string

Kind names a GitHub object class.

const (
	KindVar        Kind = "vars"
	KindSecret     Kind = "secrets"
	KindDependabot Kind = "dependabot"
)

Jump to

Keyboard shortcuts

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