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 ¶
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 ¶
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.
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) 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.
type VersionStamp ¶
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) Name ¶
func (VersionStamp) Name() string