labelsync

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Plugin = struct {
	Name        string
	CLIName     string
	Description string
	Trigger     string
	Flags       []FlagDef
	Behavior    []string
}{
	Name:        "Label sync",
	CLIName:     "labelsync",
	Description: "Synchronises GitHub labels across all repositories accessible to the GitHub App installation. Labels are declared in a YAML file and applied, and optionally pruned, on every run.",
	Trigger:     "Run via `--plugin=labelsync` in CI mode, or on a schedule via the `prow-labelsync` workflow.",
	Flags: []FlagDef{
		{
			Name:        "overwrite",
			Description: "Overwrite existing labels whose color or description differs from the config.",
			Default:     "false",
		},
		{
			Name:        "prune",
			Description: "Delete labels that exist in the repository but are not defined in the config file.",
			Default:     "false",
		},
		{
			Name:        "dry_run",
			Description: "Log what would change without making any GitHub API mutations.",
			Default:     "false",
		},
	},
	Behavior: []string{
		"Lists all repositories accessible to the GitHub App installation; skips archived and forked repos.",
		"For each repository, creates any labels missing from the config.",
		"If `overwrite: true`, updates labels whose color or description has changed.",
		"If `prune: true`, deletes labels not present in the config file.",
		"API calls are parallelised with a concurrency limit of 50 to stay within GitHub secondary rate limits.",
	},
}

PluginDef is the metadata for the labelsync plugin consumed by cmd/docgen.

Functions

func LabelSync

func LabelSync()

Types

type Category added in v0.3.0

type Category struct {
	Name          string          `yaml:"name"`
	CategoryColor string          `yaml:"category_color,omitempty"`
	Labels        []CategoryLabel `yaml:"labels"`
}

type CategoryLabel added in v0.3.0

type CategoryLabel struct {
	Name        string  `yaml:"name"`
	Color       string  `yaml:"color,omitempty"`
	Description *string `yaml:"description,omitempty"`
}

type ExtraLabel added in v0.3.0

type ExtraLabel struct {
	Name        string  `yaml:"name"`
	Description *string `yaml:"description,omitempty"`
	Color       string  `yaml:"color"`
}

type FlagDef added in v0.3.0

type FlagDef struct {
	Name        string
	Description string
	Default     string
}

FlagDef documents a config file field for generated docs.

type LabelSyncConfig

type LabelSyncConfig struct {
	Overwrite   bool         `yaml:"overwrite"`
	Prune       bool         `yaml:"prune"` // Prune deletes labels not in the labels.yml file
	DryRun      bool         `yaml:"dry_run"`
	Categories  []Category   `yaml:"categories"`
	ExtraLabels []ExtraLabel `yaml:"extra_labels"`
}

func GetLabelSyncConfig

func GetLabelSyncConfig(logger *slog.Logger) (*LabelSyncConfig, error)

type Syncer added in v0.3.0

type Syncer struct {
	// contains filtered or unexported fields
}

Syncer executes a label sync run against all accessible repositories.

func NewSyncer added in v0.3.0

func NewSyncer(cfg *LabelSyncConfig, client *github.Client, logger *slog.Logger) *Syncer

func (*Syncer) Run added in v0.3.0

func (s *Syncer) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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