Skip to content

Refactor ResolveActionPin into focused resolution phases#34361

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-refactor-long-functions-again
Closed

Refactor ResolveActionPin into focused resolution phases#34361
Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-refactor-long-functions-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

pkg/workflow and pkg/actionpins have significant long-function lint debt; this PR addresses the pkg/actionpins portion by reducing ResolveActionPin complexity without changing its external contract. The pin-resolution path is now split into explicit phases to make behavior easier to reason about and extend.

  • What changed

    • Extracted dynamic resolver flow into tryDynamicActionResolution(...).
    • Extracted embedded pin fallback flow into resolveFromHardcodedPins(...).
    • Extracted unresolved/failure handling into resolveMissingActionPin(...).
    • Kept ResolveActionPin(...) as a compact orchestrator over those phases.
  • Behavior preserved

    • Same resolution precedence: dynamic resolver (when available) → embedded pins → unresolved handling.
    • Same strict/non-strict fallback semantics.
    • Same warning dedup (ctx.Warnings) and resolution-failure recording behavior.
    • Same formatting paths (FormatPinnedActionReference / formatPinnedActionWithResolution) and SHA handling.
  • Resulting structure

    • ResolveActionPin now delegates instead of inlining all branches, reducing line count and isolating responsibilities.
func ResolveActionPin(actionRepo, version string, ctx *PinContext) (string, error) {
    if resolved, ok := tryDynamicActionResolution(actionRepo, version, ctx, isAlreadySHA); ok {
        return resolved, nil
    }
    if resolved, ok := resolveFromHardcodedPins(actionRepo, version, ctx, isAlreadySHA, matchingPins); ok {
        return resolved, nil
    }
    return resolveMissingActionPin(actionRepo, version, ctx, isAlreadySHA)
}

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor long functions in pkg/workflow and pkg/actionpins Refactor ResolveActionPin into focused resolution phases May 24, 2026
Copilot AI requested a review from gh-aw-bot May 24, 2026 04:01
@pelikhan pelikhan closed this May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[lint-monster] Refactor long functions in pkg/workflow and pkg/actionpins (300+ violations)

3 participants