diff --git a/pkg/actionpins/README.md b/pkg/actionpins/README.md index ae1bed914c..0adf5a0f29 100644 --- a/pkg/actionpins/README.md +++ b/pkg/actionpins/README.md @@ -29,7 +29,7 @@ Resolution supports two modes: |----------|-----------|-------------| | `GetActionPins` | `func() []ActionPin` | Returns all loaded pins | | `GetActionPinsByRepo` | `func(repo string) []ActionPin` | Returns all pins for a repository (version-descending) | -| `GetActionPinByRepo` | `func(repo string) (ActionPin, bool)` | Returns the latest pin for a repository | +| `GetLatestActionPinByRepo` | `func(repo string) (ActionPin, bool)` | Returns the latest pin for a repository | | `FormatReference` | `func(repo, sha, version string) string` | Formats a pinned reference (`repo@sha # version`) | | `FormatCacheKey` | `func(repo, version string) string` | Formats a cache key (`repo@version`) | | `ExtractRepo` | `func(uses string) string` | Extracts the repository from a `uses` reference | diff --git a/pkg/actionpins/actionpins.go b/pkg/actionpins/actionpins.go index 3918a06117..c62f8aeb65 100644 --- a/pkg/actionpins/actionpins.go +++ b/pkg/actionpins/actionpins.go @@ -146,8 +146,8 @@ func GetActionPinsByRepo(repo string) []ActionPin { return cachedActionPinsByRepo[repo] } -// GetActionPinByRepo returns the latest ActionPin for a given repository, if any. -func GetActionPinByRepo(repo string) (ActionPin, bool) { +// GetLatestActionPinByRepo returns the latest ActionPin for a given repository, if any. +func GetLatestActionPinByRepo(repo string) (ActionPin, bool) { pins := GetActionPinsByRepo(repo) if len(pins) == 0 { return ActionPin{}, false @@ -155,9 +155,9 @@ func GetActionPinByRepo(repo string) (ActionPin, bool) { return pins[0], true } -// getActionPin returns the pinned reference for the latest version of the repo. +// getLatestActionPinReference returns the pinned reference for the latest version of the repo. // Returns an empty string if no pin is found. -func getActionPin(repo string) string { +func getLatestActionPinReference(repo string) string { pins := GetActionPinsByRepo(repo) if len(pins) == 0 { return "" @@ -320,18 +320,18 @@ func ResolveActionPin(actionRepo, version string, ctx *PinContext) (string, erro // If ctx is nil, only embedded pins are consulted. func GetCachedActionPin(repo string, ctx *PinContext) string { if ctx == nil { - return getActionPin(repo) + return getLatestActionPinReference(repo) } pins := GetActionPinsByRepo(repo) if len(pins) == 0 { - return getActionPin(repo) + return getLatestActionPinReference(repo) } latestVersion := pins[0].Version pinnedRef, err := ResolveActionPin(repo, latestVersion, ctx) if err != nil || pinnedRef == "" { - return getActionPin(repo) + return getLatestActionPinReference(repo) } return pinnedRef } diff --git a/pkg/workflow/README.md b/pkg/workflow/README.md index 5bf8614174..b46785b6c8 100644 --- a/pkg/workflow/README.md +++ b/pkg/workflow/README.md @@ -239,7 +239,7 @@ The package is intentionally large (~320 source files) because it encodes all Gi | Function | Signature | Description | |----------|-----------|-------------| | `GetActionPin` | `func(actionRepo string) string` | Returns the pinned SHA for an action | -| `GetActionPinByRepo` | `func(string) (ActionPin, bool)` | Looks up a pin by repo | +| `GetLatestActionPinByRepo` | `func(string) (ActionPin, bool)` | Looks up the latest pin by repo | | `DetectActionMode` | `func(version string) ActionMode` | Detects the action reference mode | | `ParseTagRefTSV` | `func(line string) (sha, objType string, err error)` | Parses tab-separated tag ref output into SHA and object type | | `ExtractActionsFromLockFile` | `func(lockFilePath string) ([]ActionUsage, error)` | Extracts action usages from a lock file | diff --git a/pkg/workflow/action_pins.go b/pkg/workflow/action_pins.go index 0944fe686a..4d150b463d 100644 --- a/pkg/workflow/action_pins.go +++ b/pkg/workflow/action_pins.go @@ -80,7 +80,7 @@ func getCachedActionPinFromResolver(repo string, resolver ActionSHAResolver) str // getActionPinByRepo returns the latest ActionPin for a given repository, if any. func getActionPinByRepo(repo string) (ActionPin, bool) { - return actionpins.GetActionPinByRepo(repo) + return actionpins.GetLatestActionPinByRepo(repo) } // getActionPinWithData returns the pinned action reference for a given action@version,