MCPcopy Create free account
hub / github.com/github/gh-aw / resolveGhAwSetupActionRef

Function resolveGhAwSetupActionRef

pkg/workflow/gh_aw_setup_steps.go:73–101  ·  view source on GitHub ↗

resolveGhAwSetupActionRef resolves the setup-cli action reference in priority order: 1. Use workflow-aware pin resolution (getActionPinWithData) when WorkflowData exists. 2. Otherwise use the static pin table (getActionPin) when available. 3. Otherwise fall back to repo@tag, then repo with no ref as

(config ghAwSetupStepConfig)

Source from the content-addressed store, hash-verified

71// 2. Otherwise use the static pin table (getActionPin) when available.
72// 3. Otherwise fall back to repo@tag, then repo with no ref as a final fallback.
73func resolveGhAwSetupActionRef(config ghAwSetupStepConfig) (string, error) {
74 if config.workflowData != nil {
75 actionRef := fmt.Sprintf("%s@%s", config.actionRepo, config.cliVersion)
76 pinnedRef, err := getActionPinWithData(config.actionRepo, config.cliVersion, config.workflowData)
77 if err != nil {
78 return actionRef, err
79 }
80 if pinnedRef != "" {
81 ghAwSetupLog.Printf("Using workflow-aware action pin: %s", pinnedRef)
82 return pinnedRef, nil
83 }
84 ghAwSetupLog.Printf("No workflow-aware pin available, falling back to repo@tag: %s", actionRef)
85 return actionRef, nil
86 }
87
88 actionRef := getActionPin(config.actionRepo)
89 if actionRef != "" {
90 ghAwSetupLog.Printf("Using static action pin: %s", actionRef)
91 return actionRef, nil
92 }
93
94 if config.fallbackActionRefTag != "" {
95 fallback := fmt.Sprintf("%s@%s", config.actionRepo, config.fallbackActionRefTag)
96 ghAwSetupLog.Printf("Using fallback action ref tag: %s", fallback)
97 return fallback, nil
98 }
99 ghAwSetupLog.Printf("Using bare action repo (no ref): %s", config.actionRepo)
100 return config.actionRepo, nil
101}

Callers 1

generateGhAwSetupStepFunction · 0.85

Calls 3

getActionPinWithDataFunction · 0.85
getActionPinFunction · 0.85
PrintfMethod · 0.45

Tested by

no test coverage detected