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

Method resolveActionReference

pkg/workflow/action_reference.go:132–155  ·  view source on GitHub ↗

resolveActionReference converts a local action path to the appropriate reference based on the current action mode (dev vs release vs action). If action-tag is specified in features, it overrides the mode check and enables action mode behavior (using the github/gh-aw-actions external repository). For

(localActionPath string, data *WorkflowData)

Source from the content-addressed store, hash-verified

130// For release mode: converts to SHA-pinned remote reference (e.g., "github/gh-aw/actions/create-issue@SHA # tag")
131// For action mode: converts to SHA-pinned reference in external repo if possible (e.g., "github/gh-aw-actions/create-issue@SHA # version")
132func (c *Compiler) resolveActionReference(localActionPath string, data *WorkflowData) string {
133 hasActionTag, frontmatterActionTag := getFrontmatterActionTag(data)
134
135 // For ./actions/setup, check for compiler-level actionTag override first
136 if localActionPath == "./actions/setup" {
137 return c.resolveSetupReference(data, hasActionTag, frontmatterActionTag)
138 }
139
140 if c.actionMode == ActionModeAction || hasActionTag {
141 return c.convertToExternalActionsRef(localActionPath, data)
142 }
143
144 if c.actionMode == ActionModeRelease {
145 return c.resolveReleaseActionReference(localActionPath, data)
146 }
147 if c.actionMode == ActionModeDev {
148 actionRefLog.Printf("Dev mode: using local action path: %s", localActionPath)
149 return localActionPath
150 }
151
152 // Default to dev mode for unknown modes
153 actionRefLog.Printf("WARNING: Unknown action mode %s, defaulting to dev mode", c.actionMode)
154 return localActionPath
155}
156
157func getFrontmatterActionTag(data *WorkflowData) (bool, string) {
158 if data == nil || data.Features == nil {

Calls 5

resolveSetupReferenceMethod · 0.95
getFrontmatterActionTagFunction · 0.85
PrintfMethod · 0.45

Tested by 2

TestCompilerActionTagFunction · 0.76