| 311 | } |
| 312 | |
| 313 | func stageWorkflowChanges() { |
| 314 | // Find git root and add .github/workflows relative to it |
| 315 | if gitRoot, err := gitutil.FindGitRoot(); err == nil { |
| 316 | workflowsPath := filepath.Join(gitRoot, constants.WorkflowsDirSlash) |
| 317 | _ = exec.Command("git", "-C", gitRoot, "add", workflowsPath).Run() |
| 318 | |
| 319 | // Also stage .gitattributes if it was modified |
| 320 | _ = stageGitAttributesIfChanged() |
| 321 | } else { |
| 322 | // Fallback to relative path if git root can't be found |
| 323 | _ = exec.Command("git", "add", constants.WorkflowsDirSlash).Run() |
| 324 | _ = exec.Command("git", "add", ".gitattributes").Run() |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | // ensureGitAttributes ensures that .gitattributes contains the entry to mark .lock.yml files as generated. |
| 329 | // It returns true if the file was modified, false if it was already up to date. |