convertToRemoteActionRef converts a local action path to a tag-based remote reference that will be resolved to a SHA later in the release pipeline using action pins. Uses the action-tag from WorkflowData.Features if specified (for testing), otherwise uses the version stored in the compiler binary. I
(localPath string, data *WorkflowData)
| 215 | // If compiler has actionTag set, it takes priority over both. |
| 216 | // Example: "./actions/create-issue" -> "github/gh-aw/actions/create-issue@v1.0.0" |
| 217 | func (c *Compiler) convertToRemoteActionRef(localPath string, data *WorkflowData) string { |
| 218 | // Strip the leading "./" if present |
| 219 | actionPath := strings.TrimPrefix(localPath, "./") |
| 220 | |
| 221 | // Priority order for tag selection: |
| 222 | // 1. Compiler actionTag (from --action-tag flag) |
| 223 | // 2. WorkflowData.Features["action-tag"] (from frontmatter) |
| 224 | // 3. Compiler version |
| 225 | var tag string |
| 226 | |
| 227 | // Check compiler actionTag first (highest priority) |
| 228 | if c.actionTag != "" { |
| 229 | tag = c.actionTag |
| 230 | actionRefLog.Printf("Using action-tag from compiler: %s", tag) |
| 231 | } else if data != nil && data.Features != nil { |
| 232 | // Check WorkflowData.Features for action-tag |
| 233 | if actionTagVal, exists := data.Features["action-tag"]; exists { |
| 234 | if actionTagStr, ok := actionTagVal.(string); ok && actionTagStr != "" { |
| 235 | tag = actionTagStr |
| 236 | actionRefLog.Printf("Using action-tag from features: %s", tag) |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | // Fall back to compiler version if no tag specified |
| 242 | if tag == "" { |
| 243 | tag = c.version |
| 244 | if tag == "" || tag == "dev" { |
| 245 | actionRefLog.Print("WARNING: No release tag available in binary version (version is 'dev' or empty)") |
| 246 | return "" |
| 247 | } |
| 248 | actionRefLog.Printf("Using tag from binary version: %s", tag) |
| 249 | } |
| 250 | |
| 251 | // Construct the remote reference with tag: github/gh-aw/actions/name@tag |
| 252 | // The SHA will be resolved later by action pinning infrastructure |
| 253 | remoteRef := fmt.Sprintf("%s/%s@%s", GitHubOrgRepo, actionPath, tag) |
| 254 | actionRefLog.Printf("Remote reference: %s (SHA will be resolved via action pins)", remoteRef) |
| 255 | |
| 256 | return remoteRef |
| 257 | } |
| 258 | |
| 259 | // convertToExternalActionsRef converts a local action path to a SHA-pinned (if possible) reference |
| 260 | // in the external github/gh-aw-actions repository. |