From 0c193e5211144493152e21102dc9dd175342c081 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 18:31:53 +0000 Subject: [PATCH 1/2] Initial plan From 7aeccb6f976beae1c443fcef31bf88d66a3b082b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 19:13:33 +0000 Subject: [PATCH 2/2] refactor: rename latest action pin lookup helpers Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b43c8b43-ab36-4eea-9bf7-0c41dc5d25f1 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/actionpins/README.md | 2 +- pkg/actionpins/actionpins.go | 14 +++++++------- pkg/workflow/README.md | 2 +- pkg/workflow/action_pins.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/actionpins/README.md b/pkg/actionpins/README.md index ae1bed914c7..0adf5a0f291 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 3918a061170..c62f8aeb653 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 5bf86141749..b46785b6c80 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 0944fe686aa..4d150b463d1 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,