sinks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sinks writes the in-flight tree to its destination.

Order matters and is set by the recipes: Filesystem, then VersionStamp, then GitBranch. Stamping after the commit would record a version that never shipped, and stamping into this repository rather than the pack repo is what made the sync non-convergent before (V49) -- the bump went into the runner's throwaway checkout and every run saw the same stale value.

Index

Constants

View Source
const (
	DefaultBranch        = "chore/sync-upstream-{version}"
	DefaultCommitSubject = "chore(upstream): bump {pack} to v{new}"
	DefaultCommitBody    = "Automated sync from upstream {pack} {old} -> {new}.\n\n" +
		"Generated by ichava/icon-sets-sync. See docs/maintainer-sync.md in that repository."
)

Defaults matching the Python templates.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discard

type Discard struct {
	pipeline.SinkKind
}

Discard counts the SVGs a pipeline would have written, and writes nothing.

A pipeline needs at least one sink to run. A dry run of a pack whose only sink commits has none left once the committing sinks are dropped, and failing it there would make --dry-run useless for exactly the packs a person most wants to inspect before letting them commit.

func (Discard) Execute

func (Discard) Execute(ctx *pipeline.Context) error

func (Discard) Name

func (Discard) Name() string

type Filesystem

type Filesystem struct {
	pipeline.SinkKind

	// Root is the destination, with {pack_root} and {version} interpolated.
	Root string

	// Incremental keeps what is already there. Off by default, which means
	// the destination is wiped first -- that is what removes an icon upstream
	// has deleted. An incremental sink would leave it in the pack forever.
	Incremental bool

	// MinRetention refuses to replace a populated destination with
	// substantially fewer files, as a fraction of what is already there.
	// Zero disables the check.
	//
	// Because the wipe is the point, it is also the hazard. Observed while
	// building the aggregator refresh: iconoir's upstream reorganised into
	// per-weight directories, so a refresh matching one of them would have
	// replaced 1,671 committed icons with 1,383 -- deleting 288 without
	// anything failing. A pack losing a sixth of a set to an upstream
	// reshuffle should stop the run and ask, not proceed quietly on a Monday
	// morning cron.
	MinRetention float64

	Log *slog.Logger
}

Filesystem copies the refreshed SVGs into the pack repo.

func (Filesystem) Execute

func (s Filesystem) Execute(ctx *pipeline.Context) error

func (Filesystem) Name

func (Filesystem) Name() string

type GitBranch

type GitBranch struct {
	pipeline.SinkKind

	RepoRoot      string
	Branch        string
	CommitSubject string
	CommitBody    string
	Base          string
	OpenPR        bool

	Git *gitx.Git
	Log *slog.Logger
}

GitBranch commits the refreshed pack and opens a pull request.

func (GitBranch) Execute

func (s GitBranch) Execute(ctx *pipeline.Context) error

func (GitBranch) Name

func (GitBranch) Name() string

type VersionStamp

type VersionStamp struct {
	pipeline.SinkKind

	Pack *config.PackConfig
	Log  *slog.Logger
}

VersionStamp records the fetched version in the pack repo's own config.

Into the pack repo, never back into this one. The GitBranch sink commits it alongside the assets, so the version and the SVGs it describes move in one commit and the next run compares against what actually shipped.

func (VersionStamp) Execute

func (s VersionStamp) Execute(ctx *pipeline.Context) error

func (VersionStamp) Name

func (VersionStamp) Name() string

Jump to

Keyboard shortcuts

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