Documentation
¶
Overview ¶
Package pin implements the two-phase pin lifecycle: Plan builds a complete Record of what to pin (pure computation + network reads), and Commit writes the Record to disk (workflow files + lockfile).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommitOptions ¶
type CommitOptions struct {
// OnProgress is called at each phase boundary. Nil means no progress.
OnProgress func(phase string)
}
CommitOptions configures the Commit pass.
type Entry ¶
type Entry struct {
NWO string `json:"nwo"`
Ref string `json:"ref"`
SHA string `json:"sha,omitempty"`
ObservedSHA string `json:"observed_sha,omitempty"`
Resolution Resolution `json:"resolution"`
Issue string `json:"issue,omitempty"`
Reason string `json:"reason,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
AutoFixedRef string `json:"auto_fixed_ref,omitempty"` // original ref before sane-release rewrite
OnBranch string `json:"on_branch,omitempty"`
Tag string `json:"tag,omitempty"`
Workflows []string `json:"workflows"`
RequiredBy []string `json:"required_by,omitempty"`
Direct bool `json:"direct"`
FullScan bool `json:"full_scan,omitempty"`
}
Entry records the plan decision for one action dependency.
type PlanOptions ¶
type PlanOptions struct {
Resolver *resolve.Resolver
Tagger *tag.Lister
Store *lockfile.State
Pool *pinpool.Pool
RepoOwner string // for same-owner narrowing skip
RepoName string
Version string // CLI version for the record
// NoNarrow disables tag narrowing: mutable version refs (v4, v3.1)
// are kept as the lock comment instead of being resolved to full
// patch tags (v4.2.1). Bare-SHA reverse lookup still applies.
NoNarrow bool
// AcceptMoved treats ref-moved and unreachable-pin findings as
// resolvable: affected deps are pruned from the inventory and
// re-resolved to their current live SHA.
AcceptMoved bool
// Relock treats ref-moved findings (a branch or partial-version ref
// that legitimately advanced) as resolvable, re-pinning them to the
// current live SHA. Unlike AcceptMoved it leaves unreachable-pin
// findings untouched so possible tampering stays a hard error.
Relock bool
// OnProgress is called at each phase boundary with a human-readable
// label (e.g. "Resolving actions/checkout"). Nil means no progress.
OnProgress func(phase string)
// contains filtered or unexported fields
}
PlanOptions configures the Plan pass.
type Record ¶
type Record struct {
Entries []Entry
Workflows []WorkflowPlan // internal, omitted from JSON
Repo *RepoInfo
Version string
Created time.Time
}
Record is the complete output of Plan — everything Commit needs to write all changes atomically, and the authoritative run-log artifact.
func Plan ¶
Plan walks an actionmanager Report and produces a Record describing every pin action to take. It does network reads (resolve, reverse lookup, reachability) but no disk writes.
func (*Record) Investigated ¶
Investigated returns entries with Resolution == Investigate.
func (*Record) MarshalJSON ¶
MarshalJSON produces the run-log JSON with schema, tool info, summary, and deduplicated action entries.
func (*Record) Narrowed ¶ added in v0.1.0
Narrowed returns verified entries whose refs were upgraded (AutoFixedRef set).
func (*Record) Unresolved ¶
Unresolved returns entries with Resolution == Unresolved.
type RepoInfo ¶
type RepoInfo struct {
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
Host string `json:"host,omitempty"`
}
RepoInfo identifies the repository the run scanned.
type Resolution ¶
type Resolution string
Resolution describes the outcome for a single action reference.
const ( Pinned Resolution = "pinned" Verified Resolution = "verified" Investigate Resolution = "needs-investigation" Skipped Resolution = "skipped" Unresolved Resolution = "unresolved" )
Resolution values reported for an action reference.
func (Resolution) MarshalJSON ¶
func (r Resolution) MarshalJSON() ([]byte, error)
MarshalJSON emits the resolution string.
func (Resolution) String ¶
func (r Resolution) String() string
String returns the resolution as a string.
func (*Resolution) UnmarshalJSON ¶
func (r *Resolution) UnmarshalJSON(b []byte) error
UnmarshalJSON parses a resolution string.
type Summary ¶
type Summary struct {
Workflows int `json:"workflows"`
Actions int `json:"actions"`
Valid bool `json:"valid"`
Pinned int `json:"pinned"`
AlreadyPinned int `json:"already_pinned"`
FullScan int `json:"full_scan"`
Investigate int `json:"needs_investigation"`
Skipped int `json:"skipped"`
Unresolved int `json:"unresolved"`
}
Summary is the run's roll-up: counts by resolution.
type WorkflowPlan ¶
WorkflowPlan records what Commit must write for one workflow file. Internal to the pin lifecycle; not serialized.